Server can not use its gateway.

Issues related to configuring your network
Post Reply
ulusegemen
Posts: 3
Joined: 2020/09/18 08:49:57

Server can not use its gateway.

Post by ulusegemen » 2020/09/18 09:09:16

Hi All,

I have a terrible time with my Centos 7. My network subnet was x.y.z.t//27 on my SW. Then I required from our host company to make it larger and changed it to x.y.z.t/26. When I set an IP from /26(new), it can not reach to gw. But When I set an IP from /27 (old), it can reach properly.

Do you have any suggestion for this case?

[root@test-server ~]# cat /etc/sysconfig/network-scripts/ifcfg-em1
TYPE=Ethernet
BOOTPROTO=static
DEFROUTE=no
IPV4_FAILURE_FATAL=no
NAME=em1
UUID=baf4a5e1-3eb9-4aa7-81ef-6790a20f05db
DEVICE=em1
ONBOOT=yes
NM_CONTROLLED=no
IPADDR=x.x.x.90
GATEWAY=x.x.x.113
NETMASK=255.255.255.192

[root@test-server ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 x.x.x.113 0.0.0.0 UG 0 0 0 em1
169.254.0.0 0.0.0.0 255.255.0.0 U 1002 0 0 em1
169.254.0.0 0.0.0.0 255.255.0.0 U 1003 0 0 em2
x.x.x.64 0.0.0.0 255.255.255.192 U 0 0 0 em1

root@test-server ~]# traceroute 8.8.8.8
traceroute to 8.8.8.8 (8.8.8.8), 30 hops max, 60 byte packets
1 test-server (x.x.x.90) 3006.217 ms !H >>> it tries to reach server ip instead of gateway ip.

User avatar
TrevorH
Forum Moderator
Posts: 29681
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Server can not use its gateway.

Post by TrevorH » 2020/09/18 16:43:59

When debugging network problems it is self-defeating to obscure the ip addresses involved as no-one can debug it for you given the information supplied.
CentOS 6 will die in November 2020 - migrate sooner rather than later!
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 is dead, do not use it.
Full time Geek, part time moderator. Use the FAQ Luke

User avatar
jlehtone
Posts: 3101
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Server can not use its gateway.

Post by jlehtone » 2020/09/18 19:11:04

If two addresses are within same /27, then by definition they are within same /26.
In other words: if change of prefix is the only change that you did, connectivity should not have changed.

Note, the initscripts do understand (and prefer) PREFIX over NETMASK. Prefix is easier to use too.

Why don't the hosting companies offer DHCP?
Many misconfigurations would be avoided, if there were no need to use manual config.

ulusegemen
Posts: 3
Joined: 2020/09/18 08:49:57

Re: Server can not use its gateway.

Post by ulusegemen » 2020/09/21 12:35:46

Thank you for your response.

Actually no, both IP addresses in different subnet. (x.x.x.90 in /26) and (x.x.x.97 in /27) But /26 subnet contains /27 subnet.
My subnet was /27 (x.x.x.96/27). Because I need wider subnet, they make it wider /26 (x.x.x.64/26) but now I can not use an IP from /26.

I wanna make sure all config on centos is correct because my provider said there is no issue on their side. They did not see any packet on their fw when I try to ping 8.8.8.8.

Yes before using SUBNET I was using PREFIX. I changed it to make sure that it might causes my current problem.

User avatar
jlehtone
Posts: 3101
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Server can not use its gateway.

Post by jlehtone » 2020/09/21 15:25:38

Let me recap:
You had address x.97/27 and GW was x.113 (which is in the same x.96/27).
You got subnet x.64/26, which includes x.97 and x.113.

Who is x.90? Why did you change x.97 into x.90? You did get more addresses,
but why would you change this machine's address?

ulusegemen
Posts: 3
Joined: 2020/09/18 08:49:57

Re: Server can not use its gateway.

Post by ulusegemen » 2020/09/21 17:38:34

Hi, yes you are right for below;

My gateway is the sam for /26 and /27

You had address x.97/27 and GW was x.113 (which is in the same x.96/27).
You got subnet x.64/26, which includes x.97 and x.113.

Actually I dont care to change it. The only thing that I want is adding new servers to my cluster. The only IP address left from /27 is .97
After set a new first server I put .90 and it did not work. For tshooting, I am setting .90 and .97 to see what is differences between two IP addresses.

Post Reply

Return to “CentOS 7 - Networking Support”