We help IT Professionals succeed at work.

Failing to add default gateway

route add default gw 192.168.0.254

Open in new window

The output is
SIOCADDRT: Network is unreachable.

Network is ok, because it works when I reload it to fedora live.
It does not work only on installed fedora
Comment
Watch Question

Zephyr ICTCloud Architect

Commented:
I assume you're using DHCP?

Is there a global gateway set in /etc/sysconfig/network?

Did you check the network-scripts for the interface, for example " /etc/sysconfig/network-scripts/ifcfg-eth0 " 
Basically open this file and check if settings seem ok...

If I remember correctly you can set a default gateway per interface like this: " default via X.X.X.X dev int " where int is your interface like eth0 for example...

" default via 192.168.0.254 dev eth0 "
Using the route add command will not survive a reboot.  You have to put the default route into a configuration file for it to survive a reboot.

Typically you put the default gateway into your interface configuration file (example; /etc/sysconfig/network-scripts/ifcfg-eth0".

Like so:
GATEWAY=10.0.0.1

Author

Commented:
savone, adding GATEWAY=192.168.0.254
does not work.
spravtek,
Basically open this file and check if settings seem ok...
I don't know what does mean all those settings, but still thank you.
Zephyr ICTCloud Architect

Commented:
Can you take a screenshot or copy what is in this file?

Did you try doing: default via 192.168.0.254 dev eh 0

Author

Commented:
do not understand, is default an executable name in this command?
default via 192.168.0.254 dev eh 0 

Open in new window

maybe something like this?
route default via 192.168.0.254 dev eh 0 

Open in new window

Please, be more specific.

Sure, here is a screenshot of the file of em1 inteface
snapshot-network.png
Zephyr ICTCloud Architect

Commented:
Forget about the command, you tried that already anyway ...

The screenshot seems to not be showing something?

Author

Commented:
)))) wait, it's another issue, which interferred with this issue.
Fedora is so fedora.

Let's me send you text file

Author

Commented:
I hope this file is not empty))))
ifcfg-em1
Cloud Architect
Commented:
Ok,

Set
IPV6INIT=no

Set
onboot=yes

Try with the gateway= removed for now ... Save the file and reboot ... Let me know the results.

Author

Commented:
works, thanks)
Zephyr ICTCloud Architect

Commented:
No prob ... Thanks for sticking with it :)