LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 08-26-2009, 06:37 AM   #16
wolfperkins
Member
 
Registered: Oct 2007
Location: Val-des-Monts, Québec, Canada
Distribution: CentOS, RHEL, Fedora
Posts: 110

Rep: Reputation: 16

The christravel reference must come from your local host file
Code:
grep 192.168.1.6 /etc/hosts
 
Old 08-26-2009, 07:28 AM   #17
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Question

Quote:
Originally Posted by wolfperkins View Post
The christravel reference must come from your local host file
Code:
grep 192.168.1.6 /etc/hosts
Code:
# cat /etc/hosts
127.0.0.1 localhost.localdomain localhost machine

# The following lines are desirable for IPv6 capable hosts
192.168.1.1 2WIRE133

Last edited by fopetesl; 08-26-2009 at 07:29 AM. Reason: typo
 
Old 08-26-2009, 07:50 AM   #18
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Check /etc/networks as well.
You have two host routes for the device. Only have one for the NIC device that connects to the device.

This command should not have been run:
route add -host 192.168.1.6 dev eth1
 
Old 08-26-2009, 09:07 AM   #19
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Question

Quote:
Originally Posted by jschiwal View Post
Check /etc/networks as well.
Code:
 cat /etc/networks
cat: /etc/networks: No such file or directory
Quote:
This command should not have been run:
route add -host 192.168.1.6 dev eth1
Code:
root@machine:/home/Peter# route add -host 192.168.1.6 dev eth0
root@machine:/home/Peter# route
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use 
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
christravel     *               255.255.255.255 UH    0      0        0 eth0
192.168.1.0     *               255.255.255.0   U     0      0        0 eth1
192.16.1.0      *               255.255.255.0   U     0      0        0 eth0
default         2WIRE133        0.0.0.0         UG    0      0        0 eth1
root@machine:/home/Peter# ping 192.168.1.6
PING 192.168.1.6 (192.168.1.6) 56(84) bytes of data.
From 192.168.1.38 icmp_seq=2 Destination Host Unreachable
From 192.168.1.38 icmp_seq=3 Destination Host Unreachable
From 192.168.1.38 icmp_seq=4 Destination Host Unreachable
From 192.168.1.38 icmp_seq=6 Destination Host Unreachable
From 192.168.1.38 icmp_seq=7 Destination Host Unreachable
From 192.168.1.38 icmp_seq=8 Destination Host Unreachable

--- 192.168.1.6 ping statistics ---
9 packets transmitted, 0 received, +6 errors, 100% packet loss, time 7998ms
, pipe 3
root@machine:/home/Peter#
Quote:
You have two host routes for the device. Only have one for the NIC device that connects to the device.
If I knew how or where to modify the "routes" file I would. I have no idea why there are two routes for eth1

Last edited by fopetesl; 08-26-2009 at 09:08 AM. Reason: bad statement
 
Old 08-26-2009, 09:29 AM   #20
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
You are totaly right I mixed eth1 with eth0.

I guess we should give this a new start. Restart the machine and see what routes are available. Then just add an extra route for that 192.168.1.6.

What I'm not sure of is which route takes precedence. I might just be that the extra route for the 192.168.1.6 host comes after the route entry for the network 192.168.1.0/24.
I'll see if I can dig some up on this

Just a sitenote to be not confused with those extra names of route try route -n so you just get the numbers.
 
Old 08-26-2009, 10:46 AM   #21
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Thumbs down OK. After restart network

Code:
# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.16.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth1
and after route add -host 192.168.1.6 dev eth0
Code:
 route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.6     0.0.0.0         255.255.255.255 UH    0      0        0 eth0
192.168.1.0     0.0.0.0         255.255.255.0   U     0      0        0 eth1
192.16.1.0      0.0.0.0         255.255.255.0   U     0      0        0 eth0
0.0.0.0         192.168.1.1     0.0.0.0         UG    0      0        0 eth1
Code:
 ping 192.168.1.6
PING 192.168.1.6 (192.168.1.6) 56(84) bytes of data.
From 192.16.1.20 icmp_seq=2 Destination Host Unreachable
From 192.16.1.20 icmp_seq=3 Destination Host Unreachable
From 192.16.1.20 icmp_seq=4 Destination Host Unreachable

--- 192.168.1.6 ping statistics ---
6 packets transmitted, 0 received, +3 errors, 100% packet loss, time 4999ms
, pipe 3
Any help?
 
Old 08-26-2009, 01:42 PM   #22
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
Quote:
Originally Posted by fopetesl View Post
Code:
root@machine:/home/Peter# echo !HH | nc 192.168.1.6 80
bash: !HH | nc 192.168.1.6 80: event not found
root@machine:/home/Peter#
The error you're seeing here is because of bash. You should put the !HH in quotes.

As for the routing, i think you're close, but instead of:

Code:
route add -host 192.168.1.6 eth0
try:

Code:
route add -host 192.168.1.6 gw 192.16.1.20
 
Old 08-26-2009, 01:55 PM   #23
rn_
Member
 
Registered: Jun 2009
Location: Orlando, FL, USA
Distribution: Suse, Redhat
Posts: 127
Blog Entries: 1

Rep: Reputation: 25
i just noticed something; you have a 192.168.1 network and you also have a 192.16.1 (eth0) network; is that correct? and the ip address of the controller you're trying to communicate to has an ip address 192.168.1.6? or is it 192.16.1.6?

I think i missed some parts of your post. could you give us an overview of your nw again, with ip addresses and the specific route you're trying to setup?
 
Old 08-26-2009, 07:12 PM   #24
evilted
Member
 
Registered: Aug 2009
Location: Ouagadougou, Burkina Faso
Distribution: centos
Posts: 92

Rep: Reputation: 18
after reading this, i have a question:

Are the two other ends of the cables attached to different physical devices? You may have looped your network and not even realized it...

if its routing:
Code:
route add -net 172.16.0.0 255.255.255.0 gw 192.168.0.x
where 192.168.0.x is the ip of the machine/router/gateway/switch/whatever hosting the other network.

Code:
for a host

route add -host 172.16.0.1 255.255.255.255 gw 192.168.0.x
you can also route through an interface, bit dodgy sometimes, but you can make the kernel look it up...
Code:
ip route add 172.16.0.0/24 dev eth0
etc, etc...


you cant exactly route a network your already on.
once you add a ip to a interface the network is already added in the routing table.

Code:
ifconfig eth0 172.16.0.1/24

route

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
172.16.0.0     *               255.255.255.0   U     0      0        0 eth1
maybe what your interested in is policy routing, but that would require different default gateways for the 2 interfaces.

if your cables are attached to different devices maybe device A is set to only allow access from eth0? and set to block everything else?
 
Old 08-27-2009, 05:18 AM   #25
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I have been misreading your IP address for eth0. It is on the 192.16.1.0 network. The device is on the 192.168.1.0 network.
Is 192.168.1.6 a typo?

Things would work out a lot better if your lan used 192.168.0.0 instead, or if you connected the device to a switch on the 192.168.1.0 LAN. This would eliminate the need for a host route.

One thing you could try is shut down eth1, and leave eth0 up on 192.168.1.20 and see if netcat works then.
 
Old 08-27-2009, 06:17 AM   #26
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Question

Quote:
Originally Posted by jschiwal View Post
I have been misreading your IP address for eth0. It is on the 192.16.1.0 network. The device is on the 192.168.1.0 network.
Is 192.168.1.6 a typo?
I do not know where 192.16.1.0 is derived from. I agree it looks like a typo and could probably be removed but as I said before I cannot find the file in which it resides.
192.168.1.6 is not a typo - it is the fixed IP address of the controller board hard linked into eth0.
Quote:
Things would work out a lot better if your lan used 192.168.0.0 instead, or if you connected the device to a switch on the 192.168.1.0 LAN. This would eliminate the need for a host route.
A switch is not an option because of the physical restraints and breaking backward compatibility.
Why would 192.168.0.0 be a better option?
Quote:
One thing you could try is shut down eth1, and leave eth0 up on 192.168.1.20 and see if netcat works then.
This is how it was previously and it works just fine with eth0 as the default gateway (even if eth1 is enabled).
 
Old 08-27-2009, 07:39 AM   #27
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
Quote:
Originally Posted by fopetesl View Post
This is how it was previously and it works just fine with eth0 as the default gateway (even if eth1 is enabled).
After reading this I dare to say that if you would delete the 192.168.1.0/24 route on the eth1 device you should be set. The problem here is that if you need any other computer in this network.
This also might be done by completly deleting the routes to the 192.168.1.0/24 network on both devices and set up host routes for all computers you need/want to talk to.....
 
Old 08-27-2009, 08:16 AM   #28
fopetesl
Member
 
Registered: Jan 2005
Location: Yorkshire Dales, UK
Distribution: Ubuntu 5.10; Mandriva 2007; Debian Lenny
Posts: 147

Original Poster
Rep: Reputation: 15
Question

Quote:
Originally Posted by zhjim View Post
After reading this I dare to say that if you would delete the 192.168.1.0/24 route on the eth1 device you should be set. The problem here is that if you need any other computer in this network.
This also might be done by completly deleting the routes to the 192.168.1.0/24 network on both devices and set up host routes for all computers you need/want to talk to.....
That sounds fine but if I had any idea how to modify the "default" routes already set up I would happily do so. As I already have said WTF are these routes set and in what file?
They certainly don't show in Network Manager GUI and none of the suggested paths/files contain this information.
 
Old 08-27-2009, 08:28 AM   #29
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Eth0 was set up with the wrong IP address. You probably mistyped it when configuring the device (by not typing the 8). Change it from 192.16.1.20 to 192.168.1.20.

I looked up "ubuntu configure routes" in google. Found this page:
http://www.ubuntugeek.com/howto-add-...in-ubuntu.html

Last edited by jschiwal; 08-27-2009 at 08:35 AM.
 
Old 08-27-2009, 08:31 AM   #30
zhjim
Senior Member
 
Registered: Oct 2004
Distribution: Debian Squeeze x86_64
Posts: 1,748
Blog Entries: 11

Rep: Reputation: 233Reputation: 233Reputation: 233
The routes for the 192.168.1.0/24 networks are setup automatical when the two devices get their IP and are set up (don't pin me on the order ). The default route normaly gets set through the dhcp client on eth1.
Take a look at /etc/network/if-up.d there are scripts that are run when a nic comes up. Just add your own script that kills the two route for the 192.168.1.0/24 network. Leave the default route as is and add a route to the 192.168.1.6 host...

Something like this.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I tell my server to use eth0 for the internet [DNS + gateway] in stead of eth1 elvisious Linux - Networking 1 02-14-2009 05:53 PM
Eth0 using DHCP and eth1 using static ip: eth0 receive internal ip not the router ip geraldomanaus Linux - Networking 3 04-23-2008 03:00 PM
eth0, eth1, dhcp, slackware 11 problem q3noob Slackware 5 07-31-2007 09:26 AM
Dhcp eth0 and XP eth1 internet sharing props666999 Slackware 8 08-20-2005 09:48 AM
How do I set the ip address for eth0, eth1 and the default gateway? abefroman SUSE / openSUSE 5 05-19-2005 04:15 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:22 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration