vi /etc/xen/xend-config.sxp
(network-script network-nat)
#(network-script network-bridge)
#(network-script network-route)
(vif-script vif-nat)
#(vif-script vif-bridge)
#(vif-script vif-route)
vif = [ 'mac=00:16:3e:38:75:47, ip=10.0.0.1' ]
dhcp="off"
vif = [ 'mac=00:16:3e:38:75:48, ip=10.0.0.2' ]
dhcp="off"
# Xen Virtual Ethernet
DEVICE=eth0
HWADDR=00:16:3e:38:75:47
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=10.0.0.1
GATEWAY=10.0.0.254
TYPE=Ethernet
# Xen Virtual Ethernet
DEVICE=eth0
HWADDR=00:16:3e:38:75:48
ONBOOT=yes
NETMASK=255.255.255.0
IPADDR=10.0.0.2
GATEWAY=10.0.0.254
TYPE=Ethernet
vif1.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet addr:10.0.0.128 Bcast:0.0.0.0 Mask:255.255.255.255
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:79 errors:0 dropped:0 overruns:0 frame:0
TX packets:29 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:7789 (7.6 KiB) TX bytes:5460 (5.3 KiB)
vif4.0 Link encap:Ethernet HWaddr FE:FF:FF:FF:FF:FF
inet addr:10.0.0.129 Bcast:0.0.0.0 Mask:255.255.255.255
inet6 addr: fe80::fcff:ffff:feff:ffff/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:74 errors:0 dropped:0 overruns:0 frame:0
TX packets:33 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:7092 (6.9 KiB) TX bytes:5552 (5.4 KiB)
ping [url]www.online.sh.cn[/url]
PING [url]www.online.sh.cn[/url] (218.1.64.33) 56(84) bytes of data.
64 bytes from 218.1.64.33: icmp_seq=1 ttl=243 time=2.40 ms
64 bytes from 218.1.64.33: icmp_seq=2 ttl=243 time=2.51 ms
/etc/init.d/network stop
/etc/init.d/NetworkManager start
/etc/init.d/NetworkManagerDispatcher start
# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination
DROP tcp -- anywhere anywhere tcp dpts:0:1023
DROP udp -- anywhere anywhere udp dpts:0:1023
DROP tcp -- anywhere anywhere tcp flags:FIN,SYN,RST,ACK/SYN
DROP icmp -- anywhere anywhere icmp echo-request
Chain FORWARD (policy DROP)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain RH-Firewall-1-INPUT (0 references)
target prot opt source destination
ACCEPT all -- anywhere anywhere
ACCEPT icmp -- anywhere anywhere icmp any
ACCEPT esp -- anywhere anywhere
ACCEPT ah -- anywhere anywhere
ACCEPT udp -- anywhere 224.0.0.251 udp dpt:mdns
ACCEPT udp -- anywhere anywhere udp dpt:ipp
ACCEPT tcp -- anywhere anywhere tcp dpt:ipp
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:ssh
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-ns
ACCEPT udp -- anywhere anywhere state NEW udp dpt:netbios-dgm
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:netbios-ssn
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:microsoft-ds
REJECT all -- anywhere anywhere reject-with icmp-host-prohibited
# iptables -L -t nat
Chain PREROUTING (policy ACCEPT)
target prot opt source destination
Chain POSTROUTING (policy ACCEPT)
target prot opt source destination
MASQUERADE all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
iptables -P FORWARD ACCEPT
Chain FORWARD (policy ACCEPT)
target prot opt source destination
iptables -A FORWARD -j ACCEPT
ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.
64 bytes from 10.0.0.1: icmp_seq=1 ttl=63 time=905 ms
64 bytes from 10.0.0.1: icmp_seq=2 ttl=63 time=0.307 ms