LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Changed IP on Red Hat box and can't reconnect (http://www.linuxquestions.org/questions/linux-networking-3/changed-ip-on-red-hat-box-and-cant-reconnect-545753/)

birkelbk 04-13-2007 09:02 AM

Changed IP on Red Hat box and can't reconnect
 
:newbie:

I'm not a new Unix admin, just new to Red Hat. I had to move a server from one subnet to another and I can't get connected to the new network. Any suggestions? Here's what I know:

The IP address shows up in the ifconfig eth0 output.
The netmask matches those of other servers on this subnet (class c).
The switch it's attached to is a cisco 6509 and the MAC address shows up on the correct port.
The server can ping itself, but nothing on the same subnet, much less outside the subnet. It can't even ping its gateway (returns a network unreachable message).
Both the server and the switch are set to full-100.


Thanks for any help!

K.B.

Lenard 04-13-2007 09:21 AM

Since you made this change did you restart the network service??

If not then; service network restart

If still having a problem check the output from the typed commands:

netstat -n
cat /etc/resolve.conf

birkelbk 04-13-2007 09:35 AM

Quote:

Originally Posted by Lenard
Since you made this change did you restart the network service??

If not then; service network restart

If still having a problem check the output from the typed commands:

netstat -n
cat /etc/resolve.conf

I actually have restarted the server serveral times. When I first hooked it up, it wasn't registering with the switch. All the pings I'm doing are by IP.

arthropod98 04-13-2007 10:25 AM

is your gateway configured correctly??

netstat -nr will show it to you.

birkelbk 04-13-2007 10:59 AM

Okay, the netstat -rn says (no network so it's not cut-n-paste)

Destination Gateway GenMask
10.133.0.0 0.0.0.0 255.255.255.0
169.254.0.0 0.0.0.0 255.255.0.0
127.0.0.0 0.0.0.0 255.0.0.0
0.0.0.0 10.133.0.3 0.0.0.0

The files I edited when changing the IP address were:
/etc/hosts (it only had the localhost address. I added the server's IP address)
/etc/sysconfig/network
/etc/sysconfig/network-scripts/ifcfg-eth0

Did I miss something?

Lenard 04-13-2007 01:17 PM

Check the /etc/sysconfig/network-scripts/ifcfg-eth0

Maybe add/edit a line entry like; GATEWAY=XXX.XXX.XXX.XXX

Example:

Code:

TYPE=Ethernet
DEVICE=eth0
HWADDR=
BOOTPROTO=
IPADDR=192.168.1.62
NETMASK=255.255.255.0
GATEWAY=192.168.1.10
DHCP_HOSTNAME=Aspier5100
DOMAIN=
ONBOOT=yes
USERCTL=yes
IPV6INIT=no
PEERDNS=no

Code:

$ netstat -nr
Kernel IP routing table
Destination    Gateway        Genmask        Flags  MSS Window  irtt Iface
192.168.1.0    0.0.0.0        255.255.255.0  U        0 0          0 eth0
172.16.94.0    0.0.0.0        255.255.255.0  U        0 0          0 vmnet8
172.16.60.0    0.0.0.0        255.255.255.0  U        0 0          0 vmnet1
0.0.0.0        192.168.1.10    0.0.0.0        UG        0 0          0 eth0


HowDoIProgramIt 04-15-2007 12:26 AM

Quote:

Originally Posted by Lenard
Check the /etc/sysconfig/network-scripts/ifcfg-eth0

Maybe add/edit a line entry like; GATEWAY=XXX.XXX.XXX.XXX

With RedHat/Fedora, the GATEWAY= entry usually goes in the machine's /etc/sysconfig/network file; in the short run, though, to get birkelbk hooked back up to his network:
Code:

$ route add default gw a.b.c.d
where a.b.c.d is the IP address of the default gateway

ought to do the trick. Do that after your "network reload" or however you're stopping & starting the network. I generally use ifup / ifdown and ifconfig; I haven't had the best of luck with or most consistent results in the world from using the /etc/rc.d/init.d/network script except at boot time where it usually works fine...

Good luck,

- Larry

camh 04-16-2007 02:16 AM

Is your network vlan'ed through the cisco? If so, you would need to change the vlan for that port to that of the new network. Just a thought..

birkelbk 04-16-2007 05:01 PM

Quote:

Originally Posted by HowDoIProgramIt
With RedHat/Fedora, the GATEWAY= entry usually goes in the machine's /etc/sysconfig/network file; in the short run, though, to get birkelbk hooked back up to his network:
Code:

$ route add default gw a.b.c.d
where a.b.c.d is the IP address of the default gateway

ought to do the trick. Do that after your "network reload" or however you're stopping & starting the network. I generally use ifup / ifdown and ifconfig; I haven't had the best of luck with or most consistent results in the world from using the /etc/rc.d/init.d/network script except at boot time where it usually works fine...

Well, I tried the route add, but it didn't work. Also, when I did the ifdown eth0 then ifup eth0, it came up as half-100. I noticed this when I started working on it, but changed it with mii-tool. How does one make full-100 permanent?

Quote:

Is your network vlan'ed through the cisco? If so, you would need to change the vlan for that port to that of the new network.
Yes, that was checked first thing. It's in the proper vlan on the switch.

BTW, I'm a she :cool:

HowDoIProgramIt 04-17-2007 11:08 AM

Quote:

Originally Posted by birkelbk
Well, I tried the route add, but it didn't work.

At this point, can you reach anything at all from that machine (or can anything else reach it) or no? Can the machine ping itself via the loopback interface (lo) or via eth0?

I started thinking about this along the lines of "it worked before it was moved, what could have changed?" and a few thoughts occurred to me; it doesn't look like you're using a dhcp or bootp server, so that's probably not it. You're sure you've got the correct address and netmask for where you are now, right; you're not on a network that's subdivided so it's not a pure class A/B/C/etc. address?

Also ... if you're using a firewall, have you tried disabling it - briefly - and seeing if you can get anywhere then? If you're using iptables, which is the default for more recent RedHat/Fedora sytems, it's probably service iptables stop and service iptables stop (service iptables [start|stop|status|etc.] is equivalent to /etc/rc.d/init.d/iptables [start|stop|status|etc.], etc.).

What does your routing table look like now (either route or netstat -nr; 6 of one...)? How about your ifconfig?
Quote:

it came up as half-100. I noticed this when I started working on it, but changed it with mii-tool
Check your /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0 files; generally, that's where settings such as duplex, etc. go. You should pretty much never have to mess with mii-tool.

A lot of distros differ with respect to how they boot up, and how they bring up services like (take a wild guess) networking. With RedHat/Fedora - usually (assuming that no one has "customized" or "enhanced" something - the way things go are as:

/etc/rc.d/init.d/network [start|stop|restart|...] etc. is the System-V style "init script" that runs whenever the system enters a runlevel that it's supposed to run at; chkconfig --list network will show you what levels those are; ntsysv can also be used to control what runs at boot time, too, but to a more limited extent. When you bring up a RedHat/Fedora system, unless you've configured it to do otherwise, the machine's going to boot up to runlevel 3 or 5; runlevel will tell you which one you're at currently, and which one you were last at, if applicable.

The way that script does its thing is by running /etc/sysconfig/network-scripts/ifup, which, in turn, runs /etc/sysconfig/network-scripts/ifup-eth - which runs /etc/sysconfig/network-scripts/ifup-eth[0-9], etc.; and, /etc/sysconfig/network-scripts/ifup-aliases, and so on.

A lot of these scripts also use info from your /etc/sysconfig/network file; a given interface's configuration is going to be set by a combination of the settings in that file, in it's interface specific init file (for example, ifcfg-eth0 for interface eth0) - and by anything that's applicable in udev (/etc/udev): /etc/udev/conf and /etc/udev/rules.d - and by anything that's applicable to a given interface in /etc/modprobe.d.

It sounded like you were familiar with a different distro & were having to manage a RedHat one; hopefully, the info above will be of some help. That's in a perfect world, though; I've seen systems where all sorts of interesting things have been done in various places.

If you hit the point where you think that you've ruled everything else out, there's always the "grab another network adapter and bring it up" approach; at least that'll tell you if something is fundamentally wrong with either your networking setup; there's always the possibility that the card itself died, too - or that it's not compatible with the particular router / concentrator / etc. that you're connecting to now. There are certain DCE/DTE combinations that flat-out will not work properly; I've found that to be the case with two specific routers when I've attempted to use them with a particular brand of laptop's built-in ethernet port.

Good luck with it; I will check back later and see if you've made any headway. I move machines around constantly, and while it admittedly turns into a project some times, it's not generally too painful. I'd like to know what's happened to you before it happens to me...

Quote:

Originally Posted by birkelbk
BTW, I'm a she :cool:

Oh gosh - I'm sorry; I'm usually very careful about about not using "his", "he" and the like. My apologies...

- Larry

birkelbk 04-18-2007 10:24 AM

Quote:

Originally Posted by HowDoIProgramIt
At this point, can you reach anything at all from that machine (or can anything else reach it) or no? Can the machine ping itself via the loopback interface (lo) or via eth0?

I can't reach anything at the moment and nothing can reach it. I can ping localhost and the local IP address. The outside ping always results in "Destination Host Unreachable" which leads me to believe that I have a network configuration problem somewhere.

Quote:

I started thinking about this along the lines of "it worked before it was moved, what could have changed?" and a few thoughts occurred to me; it doesn't look like you're using a dhcp or bootp server, so that's probably not it. You're sure you've got the correct address and netmask for where you are now, right; you're not on a network that's subdivided so it's not a pure class A/B/C/etc. address?
No DHCP or bootp. I know I've got the right netmask and address because it's in the same range as our Exchange servers and I doublechecked their netmasks to make sure I was using the right one.

Quote:

Also ... if you're using a firewall, have you tried disabling it - briefly - and seeing if you can get anywhere then? If you're using iptables, which is the default for more recent RedHat/Fedora sytems, it's probably service iptables stop and service iptables stop (service iptables [start|stop|status|etc.] is equivalent to /etc/rc.d/init.d/iptables [start|stop|status|etc.], etc.).
I tried doing service iptables stop, but that didn't change anything either.

Quote:

What does your routing table look like now (either route or netstat -nr; 6 of one...)? How about your ifconfig?
The routing table still looks like it did before (route doesn't work due to DNS not being available):


Destination Gateway GenMask
10.133.0.0 0.0.0.0 255.255.255.0
169.254.0.0 0.0.0.0 255.255.0.0
127.0.0.0 0.0.0.0 255.0.0.0
0.0.0.0 10.133.0.3 0.0.0.0


The ifconfig is correct with the IP address, netmask, broadcast and is UP.

Quote:

Check your /etc/sysconfig/network and /etc/sysconfig/network-scripts/ifcfg-eth0 files; generally, that's where settings such as duplex, etc. go. You should pretty much never have to mess with mii-tool.
Here are the contents of /etc/network:

NETWORKING=yes
HOSTNAME=hostname *changed for security reasons
GATEWAY=10.133.0.3


/etc/network-scripts/ifcfg-eth0 looks like:

DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=10.133.0.17
NETMASK=255.255.255.0
GATEWAY=10.133.0.3


I don't want to change out the NIC's because first, I don't know if we have another one; second, the likelihood of it breaking when I carried the system across the room is slight; and third, the switch is getting the MAC from it.

Thank you for all the good information about how Red Hat starts up the network. It's a lot more complicated than it needs to be, but I guess that's what you get from an OS designed by committee. :rolleyes:

Quote:

Oh gosh - I'm sorry; I'm usually very careful about about not using "his", "he" and the like. My apologies...
No worries, not offended, I just like to yank chains occassionally. ;)



Karen

HowDoIProgramIt 04-18-2007 05:15 PM

Quote:

Originally Posted by birkelbk
I can't reach anything at the moment and nothing can reach it. I can ping localhost and the local IP address. The outside ping always results in "Destination Host Unreachable" which leads me to believe that I have a network configuration problem somewhere.

I think I may have it... Nasty little thing, too...

Earlier on, when you tried:
Code:

  route add default gw 10.133.0.3
did you get
Code:

  SIOCADDRT: Network is unreachable
then, too?

The reason I ask, is that given your gateway address setting, it would generally tend to correspond to an address with a different bitmask than the one you're using; pretty much all the utilities guess at what your netmask, gateway, etc. are given what info you do give them.

Try this:
Code:

  route add default netmask 255.255.255.0 gw 10.133.0.3
I have a feeling that will do the trick...

If you want to see what netmask, route, etc. are going to use for a netmask given an ip, and so on, try ipcalc. I think what's happening here is that given the address of your gateway, route is using a netmask of /8 when it goes to add the route, and not /24:
Code:

$ ipcalc -m 10.133.0.3
NETMASK=255.0.0.0

Using that netmask, everything else is just a tad off:
Code:

$ ipcalc -m 10.133.0.3 -n 255.0.0.0
NETMASK=255.0.0.0
NETWORK=10.0.0.0

But, if we tell it what the netmask really is, things work out a little bit better:
Code:

$ ipcalc -m 10.133.0.3 -n 255.255.255.0
NETMASK=255.255.255.0
NETWORK=10.133.0.0

There was something about the gateway address being 10-dot-anything that kept gnawing at me; that, and the fact that the interface wouldn't come up for you when you tried ifconfig. It finally occurred to me to run the address through ipcalc.

Everything else you have set looks fine. I'll keep my fingers crossed... Thinking back on it, problems like that are why I got into the habit of starting and stopping an interface with ifconfig directly; once I know it works that way, I'll go ahead and automate the process. From a shell prompt, the following:
Code:

$ ifconfig eth0 up 10.133.0.17 netmask 255.255.255.0
$ route add route add default netmask 255.255.255.0 gw 10.133.0.3

should always work for you; if it doesn't, then you know you've got a problem. BTW, route -n will work if you're incommunicado with your DNS server; it's pretty much the same as netstat -rn; I can't recall why or when, but I could swear at some point I needed one or the other and only had the other.

Quote:

Thank you for all the good information about how Red Hat starts up the network. It's a lot more complicated than it needs to be, but I guess that's what you get from an OS designed by committee. :rolleyes:
My pleasure; I've been glad to have someone else help me out a time or two... It's complexity is a sort of love-hate thing for me; the way it's set up, I can get it to do anything I want it to - just not always what I meant for it to do.

Please post back as to whether or not it worked when you get a chance.

- Larry

birkelbk 04-19-2007 10:53 AM

Well, Larry, it didn't work. I'm starting to think there's some security setting that our "data security" guys set up that's not letting talk on this new network. Are you a RedHat security expert, too? Anyone else care to guide me in this, too?

Thank you!!!!

alienux 04-19-2007 10:58 AM

You don't even need a gateway to ping machines on the same subnet, so there's a basic problem that needs to be addressed before moving onto the gateway.

Is it possible that you have protected ports configured on that switch?

birkelbk 04-19-2007 01:09 PM

Quote:

Originally Posted by alienux
You don't even need a gateway to ping machines on the same subnet, so there's a basic problem that needs to be addressed before moving onto the gateway.

Is it possible that you have protected ports configured on that switch?

I don't believe so. The switch this one is attached to is open to our internal network and we can modify the ports at will.

One other thing I found out this afternoon was there is a /etc/rc.local file that has static routes listed in it that don't appear in the netstat -rn. Where are static routes applied in Red Hat?


All times are GMT -5. The time now is 08:46 PM.