April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

Categories

April 2024
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
2930  

ADDING A GATEWAY ADDRESS

[root@slave network-scripts]# nmcli con show –active
NAME UUID TYPE DEVICE
CocoChopper e8f14903-4b12-44b2-9e15-a9d47c720d14 802-3-ethernet enp0s3
hostonly febb8ba7-a989-40a7-8683-53388f70da39 802-3-ethernet enp0s8
In /etc/sysconfig/network-scripts, there will be a ifcfg-CocoChopper file which will need to be modified.

[root@slave network-scripts]# cat ifcfg-enp04
TYPE=Ethernet
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=enp04
UUID=e8f14903-4b12-44b2-9e15-a9d47c720d14
DEVICE=enp0s3
ONBOOT=yes
We can now add the gateway address in the configuration file.

[root@slave network-scripts]# vi ifcfg-enp04
TYPE=Ethernet
GATEWAY=10.0.2.254
BOOTPROTO=dhcp
DEFROUTE=yes
PEERDNS=yes
PEERROUTES=yes
IPV4_FAILURE_FATAL=no
IPV6INIT=yes
IPV6_AUTOCONF=yes
IPV6_DEFROUTE=yes
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_FAILURE_FATAL=no
NAME=CocoChopper
UUID=e8f14903-4b12-44b2-9e15-a9d47c720d14
DEVICE=enp04
ONBOOT=yes
Restart networking services and ping google.com to test connectivity.

[root@slave network-scripts]# service network restart
Restarting network (via systemctl): [ OK ]
[root@slave network-scripts]# ping google.com
PING google.com (74.125.237.96) 56(84) bytes of data.

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>