Usually, both gateways and I.P. adresses are in the same I.P. range. But it couzld append that your provider oblige you to set your both I.P. address and default gateway in a diffferent ranges.

This is exactly the case with this RHEL virtual machine :

[root@rhel ~]# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 7.2 (Maipo)

I stop NetworkManager service (and keep it stopped on a reboot) :

[root@rhel ~]# systemctl stop NetworkManager
[root@rhel ~]# systemctl disable NetworkManager
Removed symlink /etc/systemd/system/multi-user.target.wants/NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.NetworkManager.service.
Removed symlink /etc/systemd/system/dbus-org.freedesktop.nm-dispatcher.service.

Here are my network interfaces :

[root@rhel ~]# ip l
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eno16780032: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP mode DEFAULT qlen 1000
    link/ether 00:0c:29:5a:45:2e brd ff:ff:ff:ff:ff:ff

Edit “/etc/sysconfig/network-scripts/ifcfg-eno16780032” configuration file :

[root@rhel ~]# cat /etc/sysconfig/network-scripts/ifcfg-eno16780032
TYPE=Ethernet
BOOTPROTO=none
IPADDR=10.168.0.17
PREFIX=32
GATEWAY=192.168.1.1
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=eno16780032
UUID=cc04945b-b68c-45bb-8e04-2421cae56870
DEVICE=eno16780032
ONBOOT=yes

Define your default gateway :

[root@rhel ~]# cat /etc/sysconfig/network-scripts/route-eno16780032
192.168.1.1 dev eno16780032
default via 192.168.1.1 dev eno16780032

Restart network service :

[root@rhel ~]# systemctl restart network

Your new I.P. @ :

gateway

 

 

 

 

 

 

Default gateway :

gateway1

 

 

 

 

PDF24 Tools    Send article as PDF   

Leave a Reply

Your email address will not be published. Required fields are marked *


*