1829107 Members
2439 Online
109986 Solutions
New Discussion

Routing Experts?

 
SOLVED
Go to solution
Tom Dawson
Regular Advisor

Routing Experts?

I'm hoping there are some routing experts out there that can help me. This is a follow up to my previous post about "dhcpcd & default gateway".

I have a RH 7.1 machine connecting to the internet via a Cable Modem. My ISP is using dhcp to issue network configuration parameters.

I know that the dhcpcd is working because:
1. I see the /etc/dhcpcd/dhcpcd-eth0.info file updated correctly with each restart
( Thanks Eric ! ), and
2. I can take the patch cable going to the Cable Modem out of my RH machine and connect it to a HP Pavilion running Winblows 98 and I connect to the internet just fine.

But on my RH machine, the static routes do not get built. So, I've attached the output from a "route print" command on the Win98 PC.

Can someone show me what route commands I enter on linux to build the same routing table in my kernel? I recognize what I am looking at in this data, but I just don't have the background to build the route commands ( correctly ). I could use either the actual "route" commands, or parameters to be entered in the /etc/sysconfig/static-routes file.

TIA!
Tom
13 REPLIES 13
Tom Dawson
Regular Advisor

Re: Routing Experts?

Duh...
I forgot to add the following for clarity.

The data in the attached file refers to the following parameters:

IP Address: 12.220.117.52
Subnet Mask: 255.255.252.0
Default GW: 12.220.116.1

Sorry!
Eric Ladner
Trusted Contributor

Re: Routing Experts?


The command would be

route add default gw

This should be built automtically, of course, by the ifup scripts when the ethernet interface is kicked off.

I don't have my fingers on a Linux box at the moment to check this out, but if you are familiar with the scripts, poke through them and see if you can see anything funky. They are in /etc/sysconfig/network, I think, or something close to that.
Ron Kinner
Honored Contributor

Re: Routing Experts?

Tom,

What does
netstat -rn
show on your Linux box? This is the equivalent of your route print command. We need to know what you do have before we start blindly adding routes. Also let's see
netstat -r


For that matter what does
ifconfig
say.


Also what files do you have in:
/etc/dhcpc

Is there a resolv.conf?

Does your info file show a router= something?

route add default gw 12.220.116.1

should add the default gateway for you if that's all you need.

Note: Some ISP's will register the first MAC they see when you get service and ignore others until you call them and ask them to change it.

Ron
Tom Dawson
Regular Advisor

Re: Routing Experts?

Eric, Ron,

Thanks for your replies. I've included all the data you asked for in the attached document.

I executed:

route add default gw 12.220.124.1
( A new boot brought a new gw address to /etc/dhcpc/dhcpcd-eth0.info )

and received the following reponse:

SIOCADDRT: File Exists

Ron, you make a good point about the ISP registering the first MAC it sees. Because I did make my first connection with my Winblows 98 pc. But if you look at the DHCPCHADDR value in dhcpcd-eth0.info, you'll see it matches the HWaddr value for eth0 in ifconfig. So I don't think that is my problem.

Also, note that the update times match the time of reboot ( 11:34 ). So I'm pretty sure dhcpc is running with each boot and updating files correctly.
Communications on my local subnet, 192.168.69.0 ( eth1 ), seem to be working fine.

Thanks for all your help!
Tom
Ron Kinner
Honored Contributor

Re: Routing Experts?

The error just means that it already had the route. Looks like it might be working OK. The netstat -rn displays are not always the same from OS to OS. Somethings you just don't need to show in netstat like the broadcast address of 255.255.255.255 and the 224.0.0.0 is just used for multicasting. As long as you see the default gateway in there and an entry for each interface you are probably OK. See
http://www.linuxdoc.org/LDP/nag2/x-087-2-iface.netstat.html
for an example.

Can you ping the gateway?

ping 12.220.124.1

Does it just time out or does it work?

If ping works then try

nslookup 12.220.124.1

and

nslookup hp.com

and see if you get anything back.

While I'm thinking about it what does /etc/hosts look like?

Ron



Mark Fenton
Esteemed Contributor

Re: Routing Experts?

Tom, do you intend to run your own DHCP server? If so, then you should have dhcpd running on your computer, but probably not on the same interface that you plug your cable modem into.

Dynamic Host Configuration Protocol is employed by your ISP to provide your computer with the requisite info to connect to the internet. The ISP's server is running dhcpd. On your box, all you need to do is set your interface to be configured dynamically by the ISP.

/etc/sysconfig/network-scripts/ifcfg-eth0
should contain something like:

DEVICE=eth0
BOOTPROTO=dhcp

etc.

I'll try to find your previous post, but from this series, it sounds like you're mixing things up a bit.
Tom Dawson
Regular Advisor

Re: Routing Experts?

Ron,

When I ping the gateway:

ping -c 6 12.220.112.1:

ping: sendto: Operation not permitted
ping: sendto: Operation not permitted
ping: sendto: Operation not permitted
ping: sendto: Operation not permitted
ping: sendto: Operation not permitted
ping: sendto: Operation not permitted
PING 12.220.112.1 (12.220.112.1) from 12.220.112.95 : 56(84) bytes of data.

--- 12.220.112.1 ping statistics ---
6 packets transmitted, 0 packets received, 100% packet loss

With the above, I knew nslookup wouldn't work, but here goes:

nslookup 12.220.112.1:
;; connection timed out; no servers could be reached

nslookup hp.com:
;; connection timed out; no servers could be reached

And this is /etc/hosts:

cat /etc/hosts:
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
192.168.69.20 utopia

As I mentioned before, things seem to be working okay on the 192.168.69.0 subnet.

Mark,

This is my ifcfg-eth0 file:

cat /etc/sysconfig/network-scripts/ifcfg-eth0:
DEVICE=eth0
BOOTPROTO=dhcp
ONBOOT=yes
BROADCAST=
NETWORK=
NETMASK=
IPADDR=
USERCTL=no
This machine is my router to the internet. I only have three computers on my local subnet so I just configure their parameters manually. Hence, I do NOT run dhcpd on this server. But I must run dhcpcd on eth0 to connect to my ISP. My previous post had a subject of "dhcpc & default gateway".

I'm not sure what the wrapping from my browser will do to the above information so I've attached a file with all of the above in it.

Thanks a lot to all of you!
Tom
Ron Kinner
Honored Contributor
Solution

Re: Routing Experts?

Tom,

ping: sendto: Operation not permitted

implies that there is a firewall involved here somewhere. Is your Linux set up to play firewall?

Look at
ls -l /proc/net/

did it find a file called ip_fwchains?

try
ipchains -L output

if nothing then try

iptables -L output

Ron

Mark Fenton
Esteemed Contributor

Re: Routing Experts?

Boy do I feel stupod!
(Must be time to check my prescription again...)
Tom Dawson
Regular Advisor

Re: Routing Experts?

Ron,

I HAD been using iptables for firewalling on this machine. But when I saw that I was having problems, I specifically commented out the execution of my script where I was configuring NAT etc...

It's certainly possible I've missed something.

I'm not at that office today. I'll run those commands you suggest and post a reply over the weekend. I suspect that after that my question is going to be "How can I remove the 'firewall' aspects of iptables yet maintain the NAT capabilities"? Thanks!

Mark,

Don't feel too shtupid! I've known all along that I've probably missed something little. It looks like Ron may have just identified my underlying problem.

Thanks,
Tom
Ron Kinner
Honored Contributor

Re: Routing Experts?

I expect the easiest thing to do if it is running a firewall is to add the correct statements to it to get it to pass the traffic we want but that will depend on what's there already. Better also give me the output of
iptables -L input
and
iptables -L forwarding

Ron

PS I hope you are planning on awarding points if we get this fixed. I'm just a few points short of my new hat.

Tom Dawson
Regular Advisor

Re: Routing Experts?

Ron,

In the end, there were two major problems:

1. I had forgotten about iptables-save having created the /etc/sysconfig/iptables configuration file. I was commenting out and removing execute permissions from my script that created the iptables configuration, but with each reboot, /etc/init.d/iptables was using that file to reconfigure my firewall with the old ( static ) IP configuration.

2. The rc scripts ( at least under RedHat 7.1 ) are setup to execute /etc/init.d/iptables before the ethernet interfaces are configured. That worked fine when I had a static IP address/configuration. But doesn't work too well when you need the information from dhcpc to set your firewalling rules.

So I've just taken /etc/init.d/iptables out of the picture. From rc.local I source /etc/dhcpcd/dhcpcd-eth0.info and run my own iptables configuration script. We're cooking with grease now!

Thanks for all your help! It looks like you got your new hat, congratulations!

Tom
Ron Kinner
Honored Contributor

Re: Routing Experts?

Tom,

I glad you were able to get it working.

Yes, your points gave me the new hat! Thanks

Ron