如何让xenserver想通过一个IP实现共享上网,为了使虚拟机能共享上网,首先添加一个接口

ifconfig xenbr0:0 10.0.0.1 netmask 255.255.255.0 up

设置一个内网IP段

ip addr add 10.0.0.0/24 dev xenbr0

在iptables 上做nat

iptables -t nat  -A POSTROUTING -s 10.0.0.0/255.255.255.0 -j MASQUERADEiptables -I RH-Firewall-1-INPUT -s 10.0.0.0/24 -j ACCEPT
service iptables save

最后修改参数

net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 1
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.conf.lo.send_redirects = 0
net.ipv4.conf.xenbr0.send_redirects = 0
net.ipv4.conf.default.rp_filter = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.send_redirects = 0
kernel.sysrq = 1
kernel.core_uses_pid = 1
net.ipv4.tcp_syncookies = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 4294967295
kernel.shmall = 268435456
vm.dirty_ratio = 5
kernel.printk = 4 4 1 4

发表评论

电子邮件地址不会被公开。 必填项已用*标注