From Fedora Project Wiki
Description
Network tests for OpenVZ Linux Containers and Checkpoint/Restore In Userspace (CRIU)
Setup
- Open terminal
- Switch to root user:
su -
- Prepare sysctl settings for network:
sysctl -w net.ipv4.ip_forward=1
sysctl -w net.ipv4.conf.em1.forwarding=1
sysctl -w net.ipv4.conf.em1.proxy_arp=1
How to test
- Start container:
vzctl start 101
- Add network interface in container:
vzctl set 101 --netif_add em1
- Enable forwarding in virtual eth:
sysctl -w net.ipv4.conf.veth101.1.forwarding=1
- Enable proxy_arp in virtual eth:
sysctl -w net.ipv4.conf.veth101.1.proxy_arp=1
- Enter to container:
vzctl enter 101
- Enable network intarface:
ip link set em1 up
- Assign ip address to interface:
ip addr add 192.168.50.240/24 dev em1
- Add route for interface:
ip route add default via 192.168.50.254 dev em1
- Exit from container:
logout
- Enable virtual net interface:
ip link set veth101.1 up
- Add route for virtual net interface:
ip route add 192.168.50.240/32 dev veth101.1
- Enter to container:
vzctl enter 101
- Test network:
ping -c 3 192.168.50.254
- Exit from container:
logout
- Stop container:
vzctl stop 101
Expected Results
- All steps completes without error
- #13 step shows like this:
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data. 64 bytes from 8.8.8.8: icmp_seq=1 ttl=52 time=23.1 ms 64 bytes from 8.8.8.8: icmp_seq=2 ttl=52 time=23.6 ms 64 bytes from 8.8.8.8: icmp_seq=3 ttl=52 time=23.8 ms --- 8.8.8.8 ping statistics --- 3 packets transmitted, 3 received, 0% packet loss, time 2002ms rtt min/avg/max/mdev = 23.104/23.544/23.856/0.343 ms
Optional
In network tests I've used two IPs, em1 network interface. More details about them:
- 192.168.50.240 - free IP from my subnet
- 192.168.50.254 - default gw for my subnet
- em1 - name for ethernet interface