Forums

Resolved
0 votes
Hi all,

I'm getting often the following error message : network is unreachable
after googling for a while I realize I've lost the gateway like this has happend before.

So here is the route situation :
[root@home ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 enp3s0


while /etc/sysconfig/network is correctly configured :
NOZEROCONF="yes"
GATEWAY=10.0.0.xxx
GATEWAYDEV="enp3s0"

where xxx is the IP of my Internet acces point.

I need, each time, to readd the gateway like this :
route add default gw 10.0.0.xxx


to restore a correct network configuration :
[root@home ~]# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 10.0.0.xxx 0.0.0.0 UG 0 0 0 enp3s0
10.0.0.0 0.0.0.0 255.255.255.0 U 0 0 0 enp3s0


How could I fix this issue ?
My only workaround is to cron every hour to add this gateway.... not very nice...
Any idea that might remove the gateway ??
Friday, May 06 2016, 09:59 AM
Share this post:
Responses (23)
  • Accepted Answer

    Friday, January 04 2019, 07:21 PM - #Permalink
    Resolved
    0 votes
    One way to mitigate this, even as a defensive strategy is to install MultiWAN even for LAN boxes. This will prevent a misconfigured, multiple-external configuration from causing issues with the routing tables because it will place the routing under dynamic management and start to employ iproute2-style routes for traffic.

    My 2 cents.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, January 03 2019, 07:00 PM - #Permalink
    Resolved
    0 votes
    Nick Howitt wrote:

    i guess with more than one NIC set to external it gets confused. In standalone mode you should only be able to use one NIC, but if you have more than one, to stop ClearOS getting confused, I'd set the others to LAN.

    Dirk Albring wrote:
    Am I thinking about this the wrong way? Does ClearOS force gateway mode when two nics are present? Why wouldn't you want it to be standalone mode if you're only using one nic?


    Hi, you're both right.

    Interface Role Type IP Address Action
    enp2s0f0 External Static 10.15.1.3 (this one is connected)
    enp2s0f1 External DHCP ( not connected NIC)

    NIC 2 is messing up the routing table. Always thought that if a NIC is not connected it doesn't matter for the settings.

    I will configure the unused NIC as LAN (with static IP).

    Thanks for the quick responses.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, January 03 2019, 05:01 PM - #Permalink
    Resolved
    0 votes
    i guess with more than one NIC set to external it gets confused. In standalone mode you should only be able to use one NIC, but if you have more than one, to stop ClearOS getting confused, I'd set the others to LAN.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, January 03 2019, 03:59 PM - #Permalink
    Resolved
    0 votes
    Am I thinking about this the wrong way? Does ClearOS force gateway mode when two nics are present? Why wouldn't you want it to be standalone mode if you're only using one nic?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, January 03 2019, 03:55 PM - #Permalink
    Resolved
    0 votes
    Nick Howitt wrote:
    @Jan-Arie, can I suggest you configure your unused NIC as a LAN so it does not try to get a gateway?

    I agree, I guess my problem disapears when I set the 2nd NIC as LAN.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, January 03 2019, 02:24 PM - #Permalink
    Resolved
    0 votes
    @Jan-Arie, can I suggest you configure your unused NIC as a LAN so it does not try to get a gateway?
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, January 03 2019, 12:12 PM - #Permalink
    Resolved
    0 votes
    Taryck BENSIALI wrote:

    Jan-Arie van den Boogert wrote:

    Hello,

    I have the same issue with the latest version of ClearOS:
    Version ClearOS release 7.5.0 (Final)
    Kernel Version 3.10.0-862.11.6.v7.x86_64

    Added the cron.hourly script to reassign the gateway address.

    Is there a bugfix for this issue?

    Well, I'm on the same version as you and my cron script did not triger errors for months/year..
    I've added a second NIC on the Server and changed my network configuration.
    May be the fix came from this.



    I have a HP microserver with default two NICs, but only one connected. It worked correctly after installing/configuring the server a few months ago. But after updates end December I have the issue that the gateway is lost.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, January 03 2019, 11:12 AM - #Permalink
    Resolved
    0 votes
    Jan-Arie van den Boogert wrote:

    Hello,

    I have the same issue with the latest version of ClearOS:
    Version ClearOS release 7.5.0 (Final)
    Kernel Version 3.10.0-862.11.6.v7.x86_64

    Added the cron.hourly script to reassign the gateway address.

    Is there a bugfix for this issue?

    Well, I'm on the same version as you and my cron script did not triger errors for months/year..
    I've added a second NIC on the Server and changed my network configuration.
    May be the fix came from this.
    The reply is currently minimized Show
  • Accepted Answer

    Thursday, January 03 2019, 09:04 AM - #Permalink
    Resolved
    0 votes
    Hello,

    I have the same issue with the latest version of ClearOS:
    Version ClearOS release 7.5.0 (Final)
    Kernel Version 3.10.0-862.11.6.v7.x86_64

    Added the cron.hourly script to reassign the gateway address.

    Is there a bugfix for this issue?
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, June 21 2017, 06:04 PM - #Permalink
    Resolved
    0 votes
    Hi,

    thanks i've made the change and reboot. I'll recieve a email if gateway is lost again. I hope issue is fixed now...
    Thanks all for this support...:)
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, June 21 2017, 04:30 PM - #Permalink
    Resolved
    0 votes
    I think there is something wrong with your EXTIF definition in /etc/clearos/network.conf as it mentions eth0 which does not exist properly (there is no equivalent ifcfg-eth0 file). I don't know if MultiWAN works on a standalone device. If it does and you have eth0 connected, you may want to set up an ifcfg-eth0 file and use the MultiWAN app. Otherwise remove eth0 from EXTIF. You may need to restart networking (dangerous and best done from the console) or just reboot the server.
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, June 21 2017, 02:40 PM - #Permalink
    Resolved
    0 votes
    I've changed the correction script like this to get an email with the route before and after :
    #!/bin/sh
    # Check whether 0anacron was run today already
    netstat -nr | grep 10.0.0.138 > /dev/null
    if (( $? != 0 ))
    then
    logger "gateway lost => adding Gateway"
    time=`date +%Y-%m-%d\ %T`
    uuid=$(uuidgen)
    filename=/tmp/email_alert_body_$uuid.txt
    Echo "@ " $time
    echo "BEFORE : " > $filename
    netstat -nr >> $filename
    route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.138
    echo "AFTER : " >> $filename
    netstat -nr >> $filename
    mail -s "gateway lost => adding Gateway" root < $filename
    rm -f $filename
    fi
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, June 21 2017, 02:16 PM - #Permalink
    Resolved
    0 votes
    I've needed to reboot in order to return to the previous behaviour where gateway is lost sometimes.

    The provided ls & cat was after reboot.

    Here is the workaround that add the gateway every hour if needed :
    [root@home cron.hourly]# pwd
    /store/major_files/cron/cron.hourly
    [root@home cron.hourly]# cat TBE-route-add-gateway.sh
    #!/bin/sh
    # Check whether 0anacron was run today already
    netstat -nr | grep 10.0.0.138 > /dev/null
    if (( $? != 0 ))
    then
    logger "gateway lost => adding Gateway"
    route add -net 10.0.0.0 netmask 255.255.255.0 gw 10.0.0.138
    fi


    Here is the log of the loss of the gateway :
    [root@home log]# cat messages* | grep gateway
    Apr 11 02:01:01 home root: gateway lost => adding Gateway
    Apr 25 02:01:01 home root: gateway lost => adding Gateway
    May 12 02:01:01 home root: gateway lost => adding Gateway
    May 16 03:01:01 home root: gateway lost => adding Gateway
    May 19 15:01:01 home root: gateway lost => adding Gateway
    Jun 9 06:01:01 home root: gateway lost => adding Gateway
    Jun 9 07:01:01 home root: gateway lost => adding Gateway
    Jun 9 08:01:01 home root: gateway lost => adding Gateway
    Jun 9 09:01:01 home root: gateway lost => adding Gateway
    Jun 9 10:01:01 home root: gateway lost => adding Gateway
    Jun 9 11:01:01 home root: gateway lost => adding Gateway
    Jun 9 12:01:01 home root: gateway lost => adding Gateway
    Jun 9 13:01:01 home root: gateway lost => adding Gateway
    Jun 9 14:01:01 home root: gateway lost => adding Gateway
    Jun 9 15:01:01 home root: gateway lost => adding Gateway
    Jun 9 16:01:01 home root: gateway lost => adding Gateway
    Jun 9 17:01:01 home root: gateway lost => adding Gateway
    Jun 9 18:01:01 home root: gateway lost => adding Gateway
    Jun 9 19:01:01 home root: gateway lost => adding Gateway
    Jun 9 20:01:01 home root: gateway lost => adding Gateway
    Jun 9 21:01:01 home root: gateway lost => adding Gateway
    Jun 9 22:01:01 home root: gateway lost => adding Gateway
    Jun 9 23:01:01 home root: gateway lost => adding Gateway
    Jun 10 00:01:01 home root: gateway lost => adding Gateway
    Jun 10 01:01:01 home root: gateway lost => adding Gateway
    ....
    Jun 11 00:01:01 home root: gateway lost => adding Gateway
    Jun 11 01:01:01 home root: gateway lost => adding Gateway
    ....
    Jun 12 00:01:01 home root: gateway lost => adding Gateway
    Jun 12 01:01:01 home root: gateway lost => adding Gateway
    ...
    Jun 13 00:01:01 home root: gateway lost => adding Gateway
    ...
    Jun 14 00:01:01 home root: gateway lost => adding Gateway
    ... until ...
    Jun 19 00:01:01 home root: gateway lost => adding Gateway
    Jun 19 01:01:01 home root: gateway lost => adding Gateway
    ...
    Jun 20 00:01:01 home root: gateway lost => adding Gateway
    Jun 20 01:01:01 home root: gateway lost => adding Gateway
    Jun 20 02:01:01 home root: gateway lost => adding Gateway
    Jun 20 03:01:01 home root: gateway lost => adding Gateway
    Jun 20 04:01:01 home root: gateway lost => adding Gateway
    Jun 20 05:01:01 home root: gateway lost => adding Gateway
    Jun 20 06:01:01 home root: gateway lost => adding Gateway
    Jun 20 07:01:01 home root: gateway lost => adding Gateway
    Jun 20 08:01:01 home root: gateway lost => adding Gateway
    Jun 20 09:01:01 home root: gateway lost => adding Gateway
    Jun 20 10:01:01 home root: gateway lost => adding Gateway
    Jun 20 11:01:01 home root: gateway lost => adding Gateway
    Jun 20 12:01:01 home root: gateway lost => adding Gateway
    Jun 20 13:01:01 home root: gateway lost => adding Gateway
    Jun 20 14:01:01 home root: gateway lost => adding Gateway
    Jun 20 15:01:01 home root: gateway lost => adding Gateway
    Jun 20 16:01:01 home root: gateway lost => adding Gateway
    Jun 20 17:01:01 home root: gateway lost => adding Gateway
    Jun 20 18:01:01 home root: gateway lost => adding Gateway
    Jun 20 19:01:01 home root: gateway lost => adding Gateway
    Jun 20 20:01:01 home root: gateway lost => adding Gateway


    So the 9th of june around 5 to 6 morning something happend and was fixed only after reboot arounf 20th June 20hour....
    The reply is currently minimized Show
  • Accepted Answer

    Wednesday, June 21 2017, 02:05 PM - #Permalink
    Resolved
    0 votes
    Hi,

    Thanks for your reply.
    Here are the requested informations :
    [root@home ~]# ls /etc/sysconfig/network-scripts/ifcfg*
    /etc/sysconfig/network-scripts/ifcfg-enp3s0 /etc/sysconfig/network-scripts/ifcfg-lo


    And
    [root@home ~]# cat /etc/clearos/network.conf
    # Network mode
    MODE="trustedstandalone"

    # Network interface roles
    EXTIF="enp3s0 eth0"
    LANIF=""
    DMZIF=""
    HOTIF=""

    # Domain and Internet Hostname
    DEFAULT_DOMAIN="xxx.bensiali.net"
    INTERNET_HOSTNAME="xxx.bensiali.net"

    # Extra LANS
    EXTRALANS=""

    # ISP Maximum Speeds
    ENP3S0_MAX_DOWNSTREAM=773510
    ENP3S0_MAX_UPSTREAM=185690
    ENP2S0_MAX_DOWNSTREAM=0
    ENP2S0_MAX_UPSTREAM=0
    ENP1S0_MAX_DOWNSTREAM=0
    ENP1S0_MAX_UPSTREAM=0
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 20 2017, 08:48 PM - #Permalink
    Resolved
    0 votes
    Nick's question is spot on. What is the output of /etc/clearos/network.conf. If you don't have enp3s0 defined as an EXTIF then multiwan and other processes can stop your gateway.
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 20 2017, 06:44 PM - #Permalink
    Resolved
    0 votes
    What is the output of:
    ls /etc/sysconfig/network-scripts/ifcfg*
    cat /etc/clearos/network.conf
    The reply is currently minimized Show
  • Accepted Answer

    Tuesday, June 20 2017, 06:26 PM - #Permalink
    Resolved
    0 votes
    Now the fix of the route is working only few seconds (10 to 15)...
    Any idea !
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 06 2016, 03:40 PM - #Permalink
    Resolved
    0 votes
    You can get the HWADDR (MAC address) from the command "ifconfig", but I'm not sure it is worth it. Up to and including ClearOS 5.x it was worth it, but 6.x uses udev which uses the MAC address anyway. I'm not sure what the system is called that 7.x uses, but it uses specific slot identifiers and probably then udev to identify the NICs.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 06 2016, 03:22 PM - #Permalink
    Resolved
    0 votes
    here is the content of /etc/sysconfig/network-scripts/ifcfg-enp3s0
    DEVICE=enp3s0
    TYPE="Ethernet"
    ONBOOT="yes"
    USERCTL="no"
    BOOTPROTO="static"
    IPADDR="10.0.0.yyy"
    NETMASK="255.255.255.0"
    GATEWAY="10.0.0.xxx"


    How should I get HWADDR ? Will I loose it after webconfig use ?

    I don't know when gateway is lost, because I manly use COS on LAN so whatever gateway is defined I can have access.

    as expectd /var/log/syswatch contains
    Mon May  2 03:42:22 2016  info:  enp3s0 - ping check on server #1 failed - 8.8.8.8
    Mon May 2 03:42:27 2016 info: enp3s0 - ping check on server #2 failed - 54.152.208.245
    Mon May 2 03:42:27 2016 warn: enp3s0 - upstream connection problems with your ISP
    Mon May 2 03:42:27 2016 info: eth0 - ping check - no IP available
    Mon May 2 03:42:27 2016 info: eth0 - waiting for static IP reconnect


    /var/log/system
    May  2 08:40:02 home engine: exception: error: /usr/clearos/apps/registration/libraries/Registration.php (609): Connection failed: Failed to connect to 52.1.170.77: Netw$
    May 2 08:40:02 home engine: exception: debug backtrace: /usr/sbin/clearcenter-checkin (70): check_in
    May 2 08:40:02 home clearcenter-checkin: Connection failed: Failed to connect to 52.1.170.77: Network is unreachable


    Some entry of /var/log/messages
    May  2 03:42:01 home rsyslogd: [origin software="rsyslogd" swVersion="7.4.7" x-pid="1098" x-info="http://www.rsyslog.com"] rsyslogd was HUPed
    May 2 03:42:01 home systemd: Stopping The Webconfig Apache HTTP Server...
    May 2 03:42:02 home systemd: Starting The Webconfig Apache HTTP Server...
    May 2 03:42:03 home systemd: Started The Webconfig Apache HTTP Server.
    May 2 03:45:01 home systemd: Started Session 6369 of user root.
    May 2 03:45:01 home systemd: Starting Session 6369 of user root.
    May 2 03:46:17 home systemd: Removed slice user-0.slice.
    May 2 03:46:17 home systemd: Stopping user-0.slice.
    May 2 03:47:23 home dnsmasq-dhcp[1379]: DHCPREQUEST(enp3s0) 10.0.0.150 ac:9b:0a:fa:9a:76
    May 2 03:47:23 home dnsmasq-dhcp[1379]: DHCPACK(enp3s0) 10.0.0.150 ac:9b:0a:fa:9a:76 android-6a95274115a675e8
    May 2 03:50:01 home systemd: Created slice user-0.slice.
    May 2 03:50:01 home systemd: Starting user-0.slice.
    May 2 03:50:01 home systemd: Started Session 6370 of user root.
    May 2 03:50:01 home systemd: Starting Session 6370 of user root.
    May 2 03:50:01 home systemd: Started Session 6371 of user root.
    May 2 03:50:01 home systemd: Starting Session 6371 of user root.
    May 2 03:50:03 home systemd: Removed slice user-0.slice.
    May 2 03:50:03 home systemd: Stopping user-0.slice.
    May 2 03:55:01 home systemd: Created slice user-0.slice.
    May 2 03:55:01 home systemd: Starting user-0.slice.
    May 2 03:55:01 home systemd: Started Session 6372 of user root.
    May 2 03:55:01 home systemd: Starting Session 6372 of user root.
    May 2 03:55:02 home systemd: Removed slice user-0.slice.
    May 2 03:55:02 home systemd: Stopping user-0.slice.
    May 2 04:00:01 home systemd: Created slice user-0.slice.
    May 2 04:00:01 home systemd: Starting user-0.slice.
    May 2 04:00:01 home systemd: Started Session 6373 of user root.
    May 2 04:00:01 home systemd: Starting Session 6373 of user root.
    May 2 04:00:01 home systemd: Created slice user-2000.slice.
    May 2 04:00:01 home systemd: Starting user-2000.slice.
    May 2 04:00:01 home systemd: Started Session 6374 of user lazer.
    May 2 04:00:01 home systemd: Starting Session 6374 of user lazer.
    May 2 04:00:01 home systemd: Removed slice user-2000.slice.
    May 2 04:00:01 home systemd: Stopping user-2000.slice.
    May 2 04:00:01 home systemd: Removed slice user-0.slice.
    May 2 04:00:01 home systemd: Stopping user-0.slice.
    May 2 04:01:01 home systemd: Created slice user-0.slice.
    May 2 04:01:01 home systemd: Starting user-0.slice.
    May 2 04:01:01 home systemd: Started Session 6375 of user root.
    May 2 04:01:01 home systemd: Starting Session 6375 of user root.
    May 2 04:01:01 home systemd: Removed slice user-0.slice.
    May 2 04:01:01 home systemd: Stopping user-0.slice.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 06 2016, 01:16 PM - #Permalink
    Resolved
    0 votes
    It looks like my ISP has not pulled his webspace yet, so I've compiled an updated kmod driver which you could try.
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 06 2016, 12:21 PM - #Permalink
    Resolved
    0 votes
    As well as having the gateway device setup as you have in /etc/sysconfig/network, I also like to make sure that the /etc/sysconfig/network-scripts/ifcfg-whatever configurations cannot be changed by setting the immutable bit as I found that webconfig tends to mess with them unexpectedly. Also, make sure the ifcfg-xxxx one for your wan has the gateway address specified. Example below. I also like to include the HWADDR so they cannot move around, especially when you have several identical NICs... Any strangeness in your /var/log/syswatch and /var/log/system logs, or even /var/log/messages for that matter, when the gateway is lost?

    [root@danda ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth1
    DEVICE=eth1
    TYPE="Ethernet"
    ONBOOT="yes"
    USERCTL="no"
    BOOTPROTO="static"
    IPADDR="192.168.2.26"
    NETMASK="255.255.255.0"
    GATEWAY="192.168.2.35"
    HWADDR="68:05:CA:10:AF:A4"
    [root@danda ~#
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 06 2016, 11:57 AM - #Permalink
    Resolved
    0 votes
    Hi Nick,

    This is the same machine. I, now, only use 1 NIC because of some troubleon local access.
    I do not plan to use has a firewall, but I was planning to use 2 different IP : On to redirect WAN access and one for LAN Access. I've give up this idea and use only one of the two NIC.
    Because I've hadded some storage controler NIC has moved from enp1s0 to enp3s0

    [root@home ~]# lspci -k | grep Eth -A 3
    03:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
    Subsystem: Super Micro Computer Inc Device 10d3
    Kernel driver in use: e1000e
    04:00.0 Ethernet controller: Intel Corporation 82574L Gigabit Network Connection
    Subsystem: Super Micro Computer Inc Device 10d3
    Kernel driver in use: e1000e
    05:04.0 VGA compatible controller: Matrox Electronics Systems Ltd. MGA G200eW WPCM450 (rev 0a)


    [root@home ~]# uname -r
    3.10.0-229.7.2.v7.x86_64
    The reply is currently minimized Show
  • Accepted Answer

    Friday, May 06 2016, 11:22 AM - #Permalink
    Resolved
    0 votes
    I note this is a different configuration t your previous one. Is it the same machine because the other one had two NIC's?

    What is the output of:
    lspci -k | grep Eth -A 3
    uname -r


    Do you see anything in your logs when you lose the gateway?
    The reply is currently minimized Show
Your Reply