setting a static IP

Issues related to configuring your network
Post Reply
jason_nixon_205
Posts: 23
Joined: 2007/05/12 13:52:02
Contact:

setting a static IP

Post by jason_nixon_205 » 2007/10/12 14:46:35

I have a 4.5 box on which I am attempting to setup a static IP. I edited the file [i]/etc/sysconfig/network-scripts/ifcfg-eth0[/i] to say:

type=ethernet
device=eth0
bootproto=
ipaddr=192.168.2.5
netmask=255.255.255.0
userctl=yes
ipv6init=no
peerdns=yes
hwaddr=
onboot=yes

I rebooted the box and verified with [b]ifconfig eth0[/b] the ip was still set. The problem is that now I can't ping anything. I updated my routes to look like this:

Dest..........................Gateway......................Genmask................Flags......Metric...Ref.........Use....Iface
default.....................192.168.2.1............255.255.255.255.............UGH.........0..........0.............0......eth0
192.168.2.0..................*..........................255.255.255.0..............U.............0..........0.............0......eth0
169.254.0.0..................*...........................255.255.0.0.................U.............0..........0.............0......eth0


Still can't ping anything. I try to ping 192.168.2.1 (my default gw) and get 100% packet lost, destination host unreachable.

For security I had made some changes to the file [i]/etc/sysctl.conf[/i] such as shutting down response to ICMP echo. Actually, I [b]cp[/b] [i]/etc/sysctl.conf[/i] to [i]/etc/sysctl.conf.2[/i] for backup. Then edited the original. Anyway, I then made all the above changes and started having the ping problem. I remembered that I turned off ICMP echo so I went back and put the original [i]/etc/sysctl.conf[/i] back in place and removed the modified one.

So here's the question: Why doesn't ping work?

bonus question:
once ping does start working how can I get the route I added to become permanent?

jason_nixon_205
Posts: 23
Joined: 2007/05/12 13:52:02
Contact:

Re: setting a static IP

Post by jason_nixon_205 » 2007/10/12 15:02:51

I just did an [b]arp[/b] and found that both hosts listed ,2.1 & 2.11, say (incomplete) where it should have their mac listed. So apparently I'm not arping either.

K_Frye
Posts: 425
Joined: 2005/07/13 01:48:35
Location: Canada

setting a static IP

Post by K_Frye » 2007/10/12 15:56:20

[quote]
jason_nixon_205 wrote:
I have a 4.5 box on which I am attempting to setup a static IP. I edited the file [i]/etc/sysconfig/network-scripts/ifcfg-eth0[/i] to say:
[/quote]

You could have just used the "system-config-network" command to do this.

[quote]
So here's the question: Why doesn't ping work?
[/quote]

Start at the beginning. Run system-config-network and get your IP settings sorted out. Reboot when you're done.

Next, try pinging 127.0.0.1 and the IP you gave the CentOS box (192.168.x.y). If all is good, try pinging the gateway.

You might also want to check your firewall rules to make sure you're not doing something odd.

jason_nixon_205
Posts: 23
Joined: 2007/05/12 13:52:02
Contact:

Re: setting a static IP

Post by jason_nixon_205 » 2007/10/12 17:52:08

I checked the firewall rules and they were fine (actually i did [b]iptstate[/b] in one window and [b]arp[/b] in another window and watch everything, nothing got blocked. I did that with [b]ping[/b] also, same result).

I turned out to be a network problem. The layer 3 guy here at my office (that's OSI layer 3, not helpdesk layer 3) had me on the wrong subnet!! As soon as I plugged in to the correct subnet it worked like magic.

I truly appreciate your response though. Sometimes the forums are the only place to find anwsers. I'm beginning to try to respond to other peoples' questions myself... to give back a little.

thanks again

User avatar
toracat
Forum Moderator
Posts: 7388
Joined: 2006/09/03 16:37:24
Location: California, US
Contact:

Re: setting a static IP

Post by toracat » 2007/10/12 17:57:33

[quote]
I truly appreciate your response though. Sometimes the forums are the only place to find anwsers. I'm beginning to try to respond to other peoples' questions myself... to give back a little.
[/quote]
Way to go! That's the "C" in CentOS.

Post Reply

Return to “CentOS 4 - Networking Support”