Howto configure sub interface or secondary IP address on Redhat RHEL

Howto configure sub interface or secondary IP address on Redhat RHEL

1. Currently we have interface eth0 on our Server

[root@FileServer ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP ql en 1000
link/ether 00:0c:29:57:eb:8d brd ff:ff:ff:ff:ff:ff
inet 192.168.129.137/24 brd 192.168.129.255 scope global eth0
inet6 fe80::20c:29ff:fe57:eb8d/64 scope link
valid_lft forever preferred_lft forever
3: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 56:37:d4:6f:20:3b brd ff:ff:ff:ff:ff:ff
[root@FileServer ~]#

2. Create sub interface or Secondary IP Address by command on Redhat

[root@FileServer ~]# ifconfig eth0:1 192.168.129.138
[root@FileServer ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:57:eb:8d brd ff:ff:ff:ff:ff:ff
inet 192.168.129.137/24 brd 192.168.129.255 scope global eth0
inet 192.168.129.138/24 brd 192.168.129.255 scope global secondary eth0:1
inet6 fe80::20c:29ff:fe57:eb8d/64 scope link
valid_lft forever preferred_lft forever
3: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 56:37:d4:6f:20:3b brd ff:ff:ff:ff:ff:ff
[root@FileServer ~]#

3. Create sub interface in network-scripts for permanently.

[root@FileServer ~]# cd /etc/sysconfig/network-scripts/
[root@FileServer network-scripts]# cp ifcfg-eth0 ifcfg-eth0:1
[root@FileServer network-scripts]# vi ifcfg-eth0:1
DEVICE=”eth0:1″
BOOTPROTO=”static”
HWADDR=”00:0C:29:57:EB:8D”
IPADDR=192.168.129.138
NETMASK=255.255.255.0
IPV6INIT=”yes”
NM_CONTROLLED=”yes”
ONBOOT=”yes”
TYPE=”Ethernet”
UUID=”361aa3b5-9d36-4bcd-818d-840dc2a19a02″
[root@FileServer network-scripts]#

[root@FileServer ~]# ip addr
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 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
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
link/ether 00:0c:29:57:eb:8d brd ff:ff:ff:ff:ff:ff
inet 192.168.129.137/24 brd 192.168.129.255 scope global eth0
inet 192.168.129.138/24 brd 192.168.129.255 scope global secondary eth0:1
inet6 fe80::20c:29ff:fe57:eb8d/64 scope link
valid_lft forever preferred_lft forever
3: pan0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN
link/ether 56:37:d4:6f:20:3b brd ff:ff:ff:ff:ff:ff
[root@FileServer ~]#

That’s all. Thanks for using IThelpblog.com

 

Leave a reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>