Table of Contents
Centos Networking
Centos Network interfaces examples
Static
[root@hydrogen]# cat /etc/sysconfig/network-scripts/ifcfg-eth0 DEVICE="eth0" BOOTPROTO="none" HWADDR="52:54:00:5B:C7:10" ONBOOT="yes" IPADDR=192.168.5.24 NETMASK=255.255.255.0 DEFROUTE=yes [root@hydrogen]#
$ cat /etc/sysconfig/network HOSTNAME=server.name.pri NETWORKING=yes NETWORKING_IPV6=yes GATEWAY=192.168.1.10
$ cat /etc/resolv.conf search mydomain.co.uk mydomain.pri nameserver 192.168.1.1
DHCP
DEVICE="eth0" BOOTPROTO="dhcp" ONBOOT=yes
Bonding
$ cat /etc/sysconfig/network-scripts/ifcfg-eth[0-1] DEVICE="eth0" HWADDR="50:E5:49:1D:75:B1" NM_CONTROLLED="no" ONBOOT="yes" BOOTPROTO=none MASTER=bond0 SLAVE=yes USERCTL=no DEVICE="eth1" HWADDR="00:10:18:27:62:98" NM_CONTROLLED="no" ONBOOT="yes" BOOTPROTO=none MASTER=bond0 SLAVE=yes USERCTL=no
$ cat /etc/sysconfig/network-scripts/ifcfg-bond0 DEVICE=bond0 IPADDR=192.168.1.1 NETMASK=255.255.255.0 GATEWAY=192.168.1.1 ONBOOT=yes BOOTPROTO=none USERCTL=no
$ cat /etc/sysconfig/network HOSTNAME=server.name.pri NETWORKING=yes NETWORKING_IPV6=yes GATEWAY=192.168.1.10
VLAN driver
This requires the 802.1q module to talk to the Cisco switch:-
# modprobe 8021q
Not tested.
Bonding with VLAN driver and bridging
No specific switch config is required for this, but the switch ports need to be trunks not access ports.
Not tested.
Appendix
Possible duplicate stuff from Redhat 5
Ethernet Bonding
The bonding driver needs to be passed some parameters in modprobe.conf.
[root@db03 network-scripts]# cat /etc/modprobe.conf alias eth0 bnx2 alias eth2 bnx2 alias bond0 bonding options bond0 mode=1 miimon=100 max_bonds=2 alias bond1 bonding options bond1 mode=1 miimon=100
The mode=1
tells it to use active/passive, miimon
sets the interval to check the mii interface to detect a failed link, and max_bonds
sets the required number of bonding interfaces, default is 1.
[root@db03 network-scripts]# pwd /etc/sysconfig/network-scripts [root@gy-asp-db03 network-scripts]# cat ifcfg-bond0 DEVICE=bond0 IPADDR=192.168.206.93 NETMASK=255.255.255.0 NETWORK=192.168.206.0 ONBOOT=yes BOOTPROTO=none USERCTL=no [root@db03 network-scripts]# cat ifcfg-eth0 # Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet DEVICE=eth0 HWADDR=1C:C1:DE:07:CO:AF BOOTPROTO=none ONBOOT=yes MASTER=bond0 SLAVE=yes USERCTL=no [root@db03 network-scripts]# cat ifcfg-eth2 # Broadcom Corporation NetXtreme II BCM5709 Gigabit Ethernet DEVICE=eth2 HWADDR=D4:85:64:68:AA:BB BOOTPROTO=none ONBOOT=yes HOTPLUG=no MASTER=bond0 SLAVE=yes USERCTL=no
IP routing
Persistent routes can be set in /etc/sysconfig/network-scripts
with a separate file for each interface:-
[root@db03 network-scripts]# cat route-bond0 GATEWAY0=192.168.206.1 NETMASK0=255.255.255.0 ADDRESS0=192.168.205.0 #.207 network not currently in use (was for ringo) #GATEWAY1=192.168.206.1 #NETMASK1=255.255.255.0 #ADDRESS1=192.168.207.0
This gives the following (edited) output:-
[root@db03 network-scripts]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface ..... 192.168.205.0 192.168.206.1 255.255.255.0 UG 0 0 0 bond0 ..... default 192.168.201.1 0.0.0.0 UG 0 0 0 bond1 [root@db03 network-scripts]#