PDA

View Full Version : Manually assigning default gateway


stokefan
2006-11-28, 10:07 AM CST
Hi all,

i'm very new to networking in Linux, and would like to manually assign an IP address to a Fedora Core 6 machine.

I think I've managed this, although I can't ping anything else on the same network, but noticed that the default gateway isn't the correct value.

can anyone tell me how to replace the value for the default gateway please?

thanks.

madscientist
2006-11-28, 05:05 PM CST
Edit the file /etc/sysconfig/network-scripts/ifcfg-eth0 (assuming it's eth0). In that file, you can edit any of the settings you'd like.

Draper
2006-11-28, 11:32 PM CST
the lazy GUI method would be to use System > Admin > Network. under the device tab select the nic the click edit at the top. towards the bottom you can assign the ip/subnet/dns/gateway

stokefan
2006-11-29, 04:06 AM CST
thanks for the advice.

I tried the GUI but something very strange happened, absolutely nothing!! Seriously, nothing at all happens when I click "Network" from the drop down menu in Gnome!

Draper
2006-11-29, 09:45 AM CST
my guess is this.. to use network you have to enter your root password in a prompt. either you didnt see it or it didnt pop up, but thats the deal with the network gui. root group only.

Zotter
2006-11-29, 12:19 PM CST
From a CLI, as root or with his privs:

#route del default <enter>

to remove whatever is in the kernel's routing table now.

Then

#route add default gw 192.168.0.1 <enter>

(change IP, of course)
Then test it. Make sure it's working. Ping an IP outside your LAN, google.com or something.
NOTE: This won't survive a re-boot! To be persistent, add your default gw to a config script as mentioned above.

On one of my boxen, I have the file:
/etc/sysconfig/networking/devices/ifcfg-eth0

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.0.0.110
NETMASK=255.255.0.0
GATEWAY=10.0.0.253
TYPE=Ethernet

stokefan
2006-12-04, 03:59 AM CST
thanks zotter, most useful. I ended up adding the line GATEWAY=my.gateway.ip in the file like yours above.