Sunday, July 17, 2016

ip addr command 4 RHEL/CentOS/Fedora

 IP addr command 4 RHEL/CentOS/Fedora

Static IP Address configuration:

[root@centos ~]# vi /etc/sysconfig/network-scripts/ifcfg-eth0


DEVICE="eth1"
BOOTPROTO=static
ONBOOT=yes
TYPE="Ethernet"
IPADDR=192.168.0.2
NAME="System eth0"
HWADDR=00:0C:00:AF:BB:4C
GATEWAY=192.168.0.1


How to Assign a IP Address to Specific Interface

ip addr add 192.168.0.2 dev eth1

How to Check an IP Address

ip addr show

How to Remove an IP Address

ip addr del 192.168.0.2/24 dev eth1


How to Enable Network Interface

ip link set eth1 up

How to Disable Network Interface

ip link set eth1 down



How do I Check Route Table

ip route show

How do I Add Static Route

ip route add 10.10.10.0/24 via 192.168.0.10 dev eth1

How to Remove Static Route

ip route del 10.10.10.0/24


How do I Add Persistence Static Routes

vi /etc/sysconfig/network-scripts/route-eth0
10.10.10.0/24 via 192.168.0.10 dev eth1

How do I Add Default Gateway

ip route add default via 192.168.0.1




No comments:

Post a Comment