Openvswitch and Fedora 19

I’ve just setup my Fedora19 to use Openvswitch . There are many howtos out there but the ones I read either didn’t cater for RHEL/Fedora or were not reboot safe.

My aim was to create a bridge interface with 2 member interfaces:_ an interface for my host _ IP (mgmt0) and the physical NIC (em1). Later, my VMs will also connect to the same virtual switch.

  1. Install Openvswitch: $ yum install openvswitch -y

  2. Start openvswitch serve and enable it at boot time:

     $ systemctl enable openvswitch.service
     $ systemctl start openvswitch.service
    
  3. Create network interface config for my bridge interface: /etc/sysconfig/network-scripts/ifcfg-ovsbr0

     DEVICE="ovsbr0" 
     ONBOOT="yes"  
     DEVICETYPE="ovs"  
     TYPE="OVSBridge"  
     BOOTPROTO="none"  
     HOTPLUG="no"
    
  4. Create a network interface for the host interface: /etc/sysconfig/network-scripts/ifcfg-mgmt0

     DEVICE="mgmt0"  
     ONBOOT="yes"  
     DEVICETYPE="ovs"  
     TYPE="OVSIntPort"  
     BOOTPROTO="dhcp"  
     HOTPLUG="no"  
     OVSBOOTPROTO=dhcp  
     OVSDHCPINTERFACES="em1"
     OVS_BRIDGE="ovsbr0"  
    

Note: the last 2 options were necessary for the interface to get DHCP at boot time

  1. Create network interface config for my physical interface: /etc/sysconfig/network-scripts/ifcfg-em1

     DEVICE=em1
     ONBOOT=yes
     NETBOOT=yes  
     UUID=bfd443dd-390b-4024-8082-e4918c6bda43  
     TYPE=Ethernet  
     DEVICETYPE="ovs"  
     TYPE="OVSPort"  
     OVS_BRIDGE="ovsbr0"  
     BOOTPROTO="none"  
     HOTPLUG="no"
    
  2. Make sure the bridge module is not loaded (this interferes with openvswitch) $ rmmod bridge

  3. Load the network configuration: $ systemctl restart network.service

That’s it! Interface mgmt0 was then able to get an IP address via DHCP, even after a reboot.

$ ip addr  
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN   
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00  
    inet 127.0.0.1/8 scope host lo  
       valid_lft forever preferred_lft forever  
    inet6 ::1/128 scope host   
       valid_lft forever preferred_lft forever  
2: <b>em1</b>: &lt;BROADCAST,MULTICAST,UP,LOWER_UP&gt; mtu 1500 qdisc pfifo_fast state UP qlen 1000  
    link/ether 18:03:73:23:50:e7 brd ff:ff:ff:ff:ff:ff  
    inet6 fe80::1a03:73ff:fe23:50e7/64 scope link   
       valid_lft forever preferred_lft forever  
7: ovs-system: &lt;BROADCAST,MULTICAST&gt; mtu 1500 qdisc noop state DOWN   
    link/ether 2e:b8:2c:b4:6c:d3 brd ff:ff:ff:ff:ff:ff  
14: **ovsbr0**: &lt;BROADCAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UNKNOWN   
    link/ether 18:03:73:23:50:e7 brd ff:ff:ff:ff:ff:ff  
    inet6 fe80::ec1f:16ff:feaa:67d7/64 scope link   
       valid_lft forever preferred_lft forever  
18: <b>mgmt0</b>: &lt;BROADCAST,UP,LOWER_UP&gt; mtu 1500 qdisc noqueue state UNKNOWN   
    link/ether 76:4d:2b:ec:a2:38 brd ff:ff:ff:ff:ff:ff  
    inet 10.129.24.62/24 brd 10.129.24.255 scope global mgmt0  
       valid_lft forever preferred_lft forever  
    inet6 fe80::744d:2bff:feec:a238/64 scope link   
       valid_lft forever preferred_lft forever

Something else I do that others may find useful when using DHCP is to define a list of domain names that are part of the domain-search when hosts get resolved.

  1. Create the following file /etc/dhcp/dhclient-mgmt0.conf

     interface "mgmt0" {  
     append domain-search "domain1.com";  
     append domain-search "domain2.com";  
     append domain-search "domain3.com";  
     }
    

[ UPDATE: Bugzilla bug 1027440 has been raised to address an issue with DHCP not being applied for OVS internal ports. ]