[ovs-discuss] How to access the Internet via OVS
Bruce SUN
bruce.sun2014 at gmail.com
Thu Jul 31 16:11:34 UTC 2014
Hi,
I just run "h1 dhclient h1-eht0". The problem is solved, but I don't know
the reason.
mininet> h2 ping www.sina.com
PING wwwus.sina.com (12.130.132.30) 56(84) bytes of data.
64 bytes from 12.130.132.30: icmp_seq=2 ttl=238 time=173 ms
64 bytes from 12.130.132.30: icmp_seq=3 ttl=238 time=167 ms
64 bytes from 12.130.132.30: icmp_seq=4 ttl=238 time=166 ms
mininet at mininet-vm:~$ ping www.sina.com
PING wwwus.sina.com (12.130.132.30) 56(84) bytes of data.
64 bytes from 12.130.132.30: icmp_seq=1 ttl=238 time=173 ms
64 bytes from 12.130.132.30: icmp_seq=2 ttl=238 time=172 ms
Could you tell me what is function of the port (the name is the same as
openvswitch bridge, like s1)? I am confused about the port. It seems
meaningless except here.
Thank you very much.
Best Regards,
Bruce
On Thu, Jul 31, 2014 at 4:55 PM, Bruce SUN <bruce.sun2014 at gmail.com> wrote:
> Hi,
>
> I have gotten the default route by running dhclient s1.
>
> Let me describe my operations.
>
> 1. Log in the VirtualBox VM, which has two Ethernet interfaces: eth0 (NAT,
> ip:10.0.2.15) for accessing the Internet and eth0 (host only, ip:
> 192.168.56.101) for ssh VM via putty
> 2. Then run " sudo mn --topo single --mac --switch ovsk --controller
> remote" to start openvswitch.
> 3. root at mininet-vm:~# ovs-vsctl add-port s1 eth0
> 4. root at mininet-vm:~# ifconfig eth0 0.0.0.0
> 5. root at mininet-vm:~# ifconfig s1 10.0.2.15
> 6. root at mininet-vm:~# ifconfig eth0 up
> 7. root at mininet-vm:~# ifconfig s1 up
> 8. root at mininet-vm:~# dhclient s1
>
> The interfaces are follows:
>
> root at mininet-vm:~# ifconfig
> eth0 Link encap:Ethernet HWaddr 08:00:27:cd:98:cc
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:434 errors:0 dropped:0 overruns:0 frame:0
> TX packets:453 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:39166 (39.1 KB) TX bytes:37682 (37.6 KB)
>
> eth1 Link encap:Ethernet HWaddr 08:00:27:62:c7:30
> inet addr:192.168.56.101 Bcast:192.168.56.255
> Mask:255.255.255.0
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:1764 errors:0 dropped:0 overruns:0 frame:0
> TX packets:1357 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:195772 (195.7 KB) TX bytes:220854 (220.8 KB)
>
> lo Link encap:Local Loopback
> inet addr:127.0.0.1 Mask:255.0.0.0
> UP LOOPBACK RUNNING MTU:65536 Metric:1
> RX packets:4237 errors:0 dropped:0 overruns:0 frame:0
> TX packets:4237 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:214466 (214.4 KB) TX bytes:214466 (214.4 KB)
>
> s1 Link encap:Ethernet HWaddr 08:00:27:cd:98:cc
> inet addr:10.0.2.15 Bcast:10.255.255.255 Mask:255.0.0.0
> UP BROADCAST RUNNING MTU:1500 Metric:1
> RX packets:15 errors:0 dropped:0 overruns:0 frame:0
> TX packets:9 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:0
> RX bytes:1430 (1.4 KB) TX bytes:888 (888.0 B)
>
> s1-eth1 Link encap:Ethernet HWaddr b2:50:5d:d8:d7:f2
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:0 (0.0 B) TX bytes:1104 (1.1 KB)
>
> s1-eth2 Link encap:Ethernet HWaddr 72:24:5e:ac:b6:eb
> UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
> RX packets:0 errors:0 dropped:0 overruns:0 frame:0
> TX packets:14 errors:0 dropped:0 overruns:0 carrier:0
> collisions:0 txqueuelen:1000
> RX bytes:0 (0.0 B) TX bytes:1104 (1.1 KB)
>
> Route is as follows:
>
> root at mininet-vm:~# route
> Kernel IP routing table
> Destination Gateway Genmask Flags Metric Ref Use
> Iface
> default 10.0.2.2 0.0.0.0 UG 0 0 0 s1
> 10.0.0.0 * 255.0.0.0 U 0 0 0 s1
> 10.0.2.0 * 255.255.255.0 U 0 0 0 s1
> 192.168.56.0 * 255.255.255.0 U 0 0 0
> eth1
>
> And ports of openvswitch are as follows:
> root at mininet-vm:~# ovs-vsctl show
> d27a9060-3edf-4ee7-a4cf-09e705c93f56
> Bridge "s1"
> Controller "ptcp:6634"
> Controller "tcp:127.0.0.1:6633"
> fail_mode: secure
> Port "eth0"
> Interface "eth0"
> Port "s1"
> Interface "s1"
> type: internal
> Port "s1-eth2"
> Interface "s1-eth2"
> Port "s1-eth1"
> Interface "s1-eth1"
> ovs_version: "2.0.1"
>
>
> I want to access the Internet from the openvswtich.
> However, neither of openvswitch and VM can not access the Internet (like
> ping www.google.com).
>
> Could you help me check my fault? Thank you very much.
>
> Best Regards,
> Bruce
>
>
>
> On Thu, Jul 31, 2014 at 4:23 PM, Ben Pfaff <blp at nicira.com> wrote:
>
>> On Thu, Jul 31, 2014 at 02:11:54PM +0100, Bruce SUN wrote:
>> > I run an Openvswith and a controller on the VM. The switch has two ports
>> > connecting two virtual hosts. Eth0 of VM is an interface which can
>> access
>> > the Internet.
>> > I am going to add eth0 (interface to internet) into the openvswitch and
>> > expect that one virtual host can access the internet as follows:
>> >
>> > ovs-vsctl add-port s1 eth0
>> >
>> > Howerver, after adding eth0 into to the openvswitch, both VM and
>> openvsiwth
>> > can not access the Internet.
>> >
>> > As s physical Ethernet device that is part of an Open vSwitch bridge
>> should
>> > not have an IP address.
>> > I try to fix the like this
>> >
>> > ifconfig eth0 0.0.0.0
>> > ifconfig s1 10.0.2.15
>> >
>> > But it still does't work.
>> >
>> > Could you tell me how to access the Internet via OVS network?
>>
>> You probably need to add a default route.
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://openvswitch.org/pipermail/ovs-discuss/attachments/20140731/6836c95b/attachment-0002.html>
More information about the discuss
mailing list