Reference : Duplicate Default Gateways

การ Add Default Route แบบชั่วคราว Restart Server ก็ต้อง Add ใหม่

# vi /etc/sysconfig/network-scripts/ifcfg-em1
DEVICE="em1"
BOOTPROTO="none"
NETWORK="192.168.199.0"
NETMASK="255.255.255.0"
IPADDR="192.168.199.5"
HWADDR="XX:XX:XX:XX:XX:XX"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"

# cat /etc/sysconfig/network-scripts/ifcfg-eno1
DEVICE=eno1
TYPE="Ethernet"
ONBOOT="yes"
USERCTL="no"
BOOTPROTO="static"
IPADDR="10.4.4.252"
NETMASK="255.255.255.0"
GATEWAY="10.4.4.1"

***** DHCP Interface Command Line *****
DEVICE=em1 
BOOTPROTO=dhcp 
ONBOOT=yes
----------------------------------------------------------------
# cat /etc/resolv.conf
----------------------------------------------------------------
# Generated by NetworkManager


# No nameservers found; try putting DNS servers into your
# ifcfg files in /etc/sysconfig/network-scripts like so:
#
# DNS1=xxx.xxx.xxx.xxx
# DNS2=xxx.xxx.xxx.xxx
# DOMAIN=lab.foo.com bar.foo.com
DNS1=61.19.245.245
DNS2=8.8.8.8
----------------------------------------------------------------
[root@localhost ~]# cat /etc/networks
default 0.0.0.0
loopback 127.0.0.0
link-local 169.254.0.0
[root@localhost ~]# service network restart

Default Route Command Line
[root@localhost ~]#  route add default gw 192.168.199.1 eth0
[root@localhost ~]#  route del default gw 192.168.199.1 eth0

การตรวจสอบ Version Linux

[root@localhost ~]# cat /etc/centos-release
CentOS release 6.3 (Final)

Configuring Static Routes

# vi /etc/sysconfig/network-scripts/route-eth0
default 192.168.199.1 dev eth0
# vi /etc/sysconfig/network-scripts/route-eth1
default 10.168.3.254 dev eth1
10.168.0.0/16 via 10.168.3.254 dev eth1
10.155.0.0/16 via 10.168.3.254 dev eth1

Network Restart for Re-Routing

# service network restart
Restarting network (via systemctl):                        [  OK  ]

Kill yum Process

[root@localhost ~]# ps -ef | grep yum
root 13715 16214 0 21:37 pts/1 00:00:00 grep yum
root 14064 11912 0 21:23 pts/0 00:00:00 /usr/bin/python /usr/bin/yum install epel-release
[root@localhost ~]# kill 14064
Advertisements