Adding Additional IP's: Might need a static route?

Issues related to configuring your network
Post Reply
qspider
Posts: 1
Joined: 2017/02/12 19:08:59

Adding Additional IP's: Might need a static route?

Post by qspider » 2017/02/12 19:23:39

Hello, ;)

I am trying to add additional IP's that use a different gateway and subnet. On CentOS 6 I was able to do this by creating a range file and then restarting the network. That doesn't seem to work here for CentOS 7. I can either get the primary IP for the server to work and no additional IP's or I lose the Primary IP and all the additional IP's work. So now I am thinking I need to create static routes but I have never done that before. Looking through the documentation for the first time is a bit confusing so I was hoping that someone could walk me through setting up one static route in CentOS 7. My network configuration is below.


ifcfg-enp2s0

Code: Select all

TYPE="Ethernet"
BOOTPROTO=none
DEFROUTE="yes"
IPV4_FAILURE_FATAL="no"
IPV6INIT="yes"
IPV6_AUTOCONF="yes"
IPV6_DEFROUTE="yes"
IPV6_FAILURE_FATAL="no"
IPV6_ADDR_GEN_MODE="stable-privacy"
NAME="enp2s0"
UUID="19b27b7d-6fd4-4db9-9bc3-5a381d72d2ae"
DEVICE="enp2s0"
ONBOOT="yes"
IPADDR=192.254.75.242
PREFIX=30
BROADCAST=192.254.75.243
NETMASK=255.255.255.252
IPV6_PEERDNS=yes
IPV6_PEERROUTES=yes
IPV6_PRIVACY=no
NM_CONTROLLED="no"

route

Code: Select all

[root@web1 network-scripts]# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
default         gateway         0.0.0.0         UG    0      0        0 enp2s0
link-local      0.0.0.0         255.255.0.0     U     1003   0        0 enp2s0
173.240.5.224   0.0.0.0         255.255.255.240 U     0      0        0 enp2s0
web1.quantumspi 0.0.0.0         255.255.255.255 UH    0      0        0 enp2s0
web1.quantumspi 0.0.0.0         255.255.255.255 UH    0      0        0 enp2s0
web1.quantumspi 0.0.0.0         255.255.255.255 UH    0      0        0 enp2s0
web1.quantumspi 0.0.0.0         255.255.255.255 UH    0      0        0 enp2s0
web1.quantumspi 0.0.0.0         255.255.255.255 UH    0      0        0 enp2s0
192.254.75.240  0.0.0.0         255.255.255.252 U     0      0        0 enp2s0

ip route

Code: Select all

[root@web1 network-scripts]# ip route
default via 192.254.75.241 dev enp2s0
169.254.0.0/16 dev enp2s0  scope link  metric 1003
173.240.5.224/28 dev enp2s0  proto kernel  scope link  src 173.240.5.234
173.240.5.234 dev enp2s0  scope link  src 173.240.5.234
173.240.5.235 dev enp2s0  scope link  src 173.240.5.235
173.240.5.236 dev enp2s0  scope link  src 173.240.5.236
173.240.5.237 dev enp2s0  scope link  src 173.240.5.237
173.240.5.238 dev enp2s0  scope link  src 173.240.5.238
192.254.75.240/30 dev enp2s0  proto kernel  scope link  src 192.254.75.242
ifconfig showing aliases. Pinging IPs from server 0% packet loss. Pinging IP's from home office show 100% packet loss.

Code: Select all

[root@web1 network-scripts]# ifconfig
enp2s0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.254.75.242  netmask 255.255.255.252  broadcast 192.254.75.243
        inet6 fe80::226:55ff:fe11:24a1  prefixlen 64  scopeid 0x20<link>
        ether 00:26:55:11:24:a1  txqueuelen 1000  (Ethernet)
        RX packets 79278  bytes 8799064 (8.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 11096  bytes 1323645 (1.2 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 17

enp2s0:1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 173.240.5.234  netmask 255.255.255.240  broadcast 173.240.5.239
        ether 00:26:55:11:24:a1  txqueuelen 1000  (Ethernet)
        device interrupt 17

enp2s0:2: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 173.240.5.235  netmask 255.255.255.240  broadcast 173.240.5.239
        ether 00:26:55:11:24:a1  txqueuelen 1000  (Ethernet)
        device interrupt 17

enp2s0:3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 173.240.5.236  netmask 255.255.255.240  broadcast 173.240.5.239
        ether 00:26:55:11:24:a1  txqueuelen 1000  (Ethernet)
        device interrupt 17

enp2s0:4: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 173.240.5.237  netmask 255.255.255.240  broadcast 173.240.5.239
        ether 00:26:55:11:24:a1  txqueuelen 1000  (Ethernet)
        device interrupt 17

enp2s0:5: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 173.240.5.238  netmask 255.255.255.240  broadcast 173.240.5.239
        ether 00:26:55:11:24:a1  txqueuelen 1000  (Ethernet)
        device interrupt 17

enp4s0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 00:26:55:11:24:a2  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 16

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1  (Local Loopback)
        RX packets 18877  bytes 4368909 (4.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 18877  bytes 4368909 (4.1 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
I have tried creating a route-enps20 file. When I restart the network I lose all additional IP's so I restart ipalieses and they come back but still aren't pingable.

Macenger
Posts: 23
Joined: 2016/10/18 08:29:57

Re: Adding Additional IP's: Might need a static route?

Post by Macenger » 2017/02/26 14:12:51

Hi,

With the primary and alias IPs in the ifconfig output, and routing rules in place, it's supposed to work. Please run the command below, and while it's running, initiate a ping from the remote host:

# tcpdump -nni -i enp2s0 icmp

Post Reply