Changes

Jump to: navigation, search

Virtual Ethernet device

11 bytes removed, 13:54, 16 February 2007
m
Making a veth-device persistent
Now we're done with VE0, we still need to add a route to the VE itself. So we start up the VE with <pre>vzctl start 101</code>, get into it with <pre>vzctl enter 101</pre> and create a new file /etc/init.d/route-up in the VE with the following content:
<codepre>
#!/bin/bash
/sbin/ip route add default dev eth0
</codepre>
Make the script executable with <pre>chmod +x /etc/init.d/route-up</pre> and add it to the runlevels:
<codepre>
ve101:/# update-rc.d route-up defaults
Adding system startup for /etc/init.d/route-up ...
/etc/rc0.d/K20route-up -> ../init.d/route-up
[...]
</codepre>
==== Checking ====
Now to see if everything worked, leave the VE with <pre>exit</pre>, stop the VE via <pre>vzctl stop 101</pre> and restart it with <pre>vzctl start 101</pre>. Still in VE0, check the route for the VE:
<codepre>
ve0:/# ip route ls
192.168.0.101 dev veth101.0 scope link
--- 192.168.0.101 ping statistics ---
4 packets transmitted, 4 recieved, 0% packet loss, time 0ms
</codepre>
If somethings not working, check the contents of the files we just created or changed. Now get into the VE via <pre>vzctl enter 101</pre> and check the routing there:
<codepre>
ve101:/# ifconfig
eth0 Link encap:Ethernet HWaddr 00:12:34:56:78:9B
--- 192.168.0.101 ping statistics ---
4 packets transmitted, 4 recieved, 0% packet loss, time 0ms
</codepre>
If you have problems getting it persistent, please comment.
 
 
 
=== Virtual ethernet devices + VLAN ===

Navigation menu