LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices

Reply
 
Search this Thread
Old 10-14-2008, 08:19 AM   #1
corteplaneta
Member
 
Registered: Jul 2007
Distribution: archlinux, ubuntu, slackware
Posts: 58

Rep: Reputation: 15
Packet Routing for Connection Sharing


Hi, I was recently discussing this in a separate thread (ndiswrapper issues), though this is now completely irrelevant from that topics, as I'm using tulip now, not a Windows driver.

Basically, I have 2 linux PC's connected with a crossover cable. "xanderbox" (192.168.1.5) is my PC with 2 NIC's that's connected to the router (eth0, gw 192.168.1.1) & to the other PC, "xravtop" (eth1, xravtop's IP is 192.168.1.8).

To route traffic to the correct NIC, I had to manually add an entry into the routing table that routes all packets from 192.168.1.8 to device eth1, and there is no gateway set.

I cannot access the internet from xravtop, as the packets are only being routed to xanderbox (192.168.1.5).

When I attempt to set the gateway for the route I added to 192.168.1.1, this just blows out the connection between the 2 crossover cable connected PC's, so this is obviously not the solution.

If anyone knows how I am able to route packets as to access the internet from the PC connected via crossover cable, it would be greatly appreciated!

I hope that was clear enough, thanks!
 
Old 10-14-2008, 08:50 AM   #2
Vit77
Member
 
Registered: Jun 2008
Location: Toronto, Canada
Distribution: Mandriva, RHEL, Mageia, SuSE
Posts: 130

Rep: Reputation: 16
If I understand you correctly, the topology of your net is following:
Code:
 Router(IP=192.168.1.1) - some active network device
   |
(eth0 = 192.168.1.5)
xanderbox
(eth1 = ?)
   |
(eth1 = 192.168.1.8)
xravtop
If so, I haven't seen the eth1's IP. IP address is assumed not to a PC, but to an interface (LAN card).

Please, clearify the topology and show traceroute output.

Last edited by Vit77; 10-14-2008 at 08:53 AM.
 
Old 10-14-2008, 11:33 AM   #3
robel
Member
 
Registered: Oct 2008
Location: Norway
Distribution: Slackware
Posts: 61

Rep: Reputation: 15
Can you please post a complete 'ifconfig' and 'ip route' on both boxes?

My first thought is that you have two NICs (eth0 and eth1) on the same subnet.
 
Old 10-14-2008, 12:59 PM   #4
corteplaneta
Member
 
Registered: Jul 2007
Distribution: archlinux, ubuntu, slackware
Posts: 58

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by Vit77 View Post
If I understand you correctly, the topology of your net is following:
Code:
 Router(IP=192.168.1.1) - some active network device
   |
(eth0 = 192.168.1.5)
xanderbox
(eth1 = ?)
   |
(eth1 = 192.168.1.8)
xravtop
If so, I haven't seen the eth1's IP. IP address is assumed not to a PC, but to an interface (LAN card).

Please, clearify the topology and show traceroute output.
I believe this is correct. I am at work right now, or I would have posted the output of those commands. I will post this in 5-6 hours. Thanks!
 
Old 10-14-2008, 04:52 PM   #5
corteplaneta
Member
 
Registered: Jul 2007
Distribution: archlinux, ubuntu, slackware
Posts: 58

Original Poster
Rep: Reputation: 15
xanderbox:

Code:
bash-3.1# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0A:E6:C5:5C:31  
          inet addr:192.168.1.6  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::20a:e6ff:fec5:5c31/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:54030 errors:0 dropped:0 overruns:0 frame:0
          TX packets:52381 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:25573210 (24.3 MiB)  TX bytes:10752041 (10.2 MiB)
          Interrupt:11 Base address:0xec00 

eth1      Link encap:Ethernet  HWaddr 00:04:5A:81:B4:40  
          inet addr:192.168.1.5  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::204:5aff:fe81:b440/64 Scope:Link
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:301955 errors:1 dropped:0 overruns:0 frame:1
          TX packets:444877 errors:54 dropped:0 overruns:0 carrier:54
          collisions:0 txqueuelen:1000 
          RX bytes:69298182 (66.0 MiB)  TX bytes:512650826 (488.9 MiB)
          Interrupt:10 Base address:0xd000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:2157 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2157 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:244322 (238.5 KiB)  TX bytes:244322 (238.5 KiB)

bash-3.1# ip route
192.168.1.8 dev eth1  scope link 
192.168.1.0/24 dev eth1  proto kernel  scope link  src 192.168.1.5 
192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.6 
127.0.0.0/8 dev lo  scope link 
default via 192.168.1.1 dev eth0
xravtop:

Code:
                                                                                                 
eth0      Link encap:Ethernet  HWaddr 00:0f:1f:be:3a:68
          inet addr:192.168.1.8  Bcast:192.168.1.255  Mask:255.255.255.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:408399 errors:72 dropped:0 overruns:0 frame:3
          TX packets:284924 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:511000237 (487.3 MB)  TX bytes:32933501 (31.4 MB)
          Interrupt:11

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:42140 errors:0 dropped:0 overruns:0 frame:0
          TX packets:42140 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:3768860 (3.5 MB)  TX bytes:3768860 (3.5 MB)


192.168.1.0/24 dev eth0  proto kernel  scope link  src 192.168.1.8
169.254.0.0/16 dev eth0  scope link  metric 1000
default via 192.168.1.6 dev eth0  metric 100
 
Old 10-15-2008, 01:58 AM   #6
robel
Member
 
Registered: Oct 2008
Location: Norway
Distribution: Slackware
Posts: 61

Rep: Reputation: 15
You do indeed have two interfaces on the same subnet. This is really not a good idea unless you plan to bundle traffic to and from the 192.168.1.0/24 subnet. I don't think you intend to do the latter.

The simple way to fix this is to use a different subnet (eg. 192.168.2.0/24) between your computers.
 
Old 10-15-2008, 06:53 AM   #7
Vit77
Member
 
Registered: Jun 2008
Location: Toronto, Canada
Distribution: Mandriva, RHEL, Mageia, SuSE
Posts: 130

Rep: Reputation: 16
In general, it seems to be possible. But you have to organize your routing correctly.
On the xravtop:
Code:
ip route add default via 192.168.1.6 dev eth0
On the xanderbox:
Code:
ip route add 192.168.1.8/32 via 192.168.1.6 dev eth0
ip route add default via 192.168.1.1 dev eth1
And check if forwarding on xanderbox is on:
Code:
cat /proc/sys/net/ipv4/ip_forward
If it shows '0', then you've got to enable it:
Code:
echo "1" > /proc/sys/net/ipv4/ip_forward
Or, to make it enabled at the boot time, add the line
Code:
net.ipv4.ip_forward = 1
in /etc/sysctl.conf on xanderbox.

With such addresses, your router must have mask 24 on the inner interface.

If you change the subnet xanderbox-xravtop to, for example, 192.168.2.0/24, you will need to add a new route to your router (192.168.1.1), something like this:
for net 192.168.2.0/24 via 192.168.1.5
Syntax depends on the router's vendor and model.

I hope, it'll help you to tune your net up.
 
Old 10-15-2008, 06:03 PM   #8
corteplaneta
Member
 
Registered: Jul 2007
Distribution: archlinux, ubuntu, slackware
Posts: 58

Original Poster
Rep: Reputation: 15
I put both PC's (eth1 on my main PC, xanderbox) & eth0 on my laptop onto the 192.168.2.x network. I was using a route like this before: "route add 192.168.1.8 netmask 255.255.255.0 dev eth1", but I'm completely baffled as what to change this to now. Sorry, I don't know much about IP--does the netmask change? I simply changed the route to "route add 192.168.2.8 netmask 255.255.255.0 dev eth1" & I once again could ping xravtop from xanderbox (& vice versa) but I still don't have the internet. There is no default gateway set for this route.

EDIT:

I just saw your post Vit77, thanks for the instruction, I'll try this out !

Last edited by corteplaneta; 10-15-2008 at 06:05 PM.
 
Old 10-15-2008, 06:25 PM   #9
corteplaneta
Member
 
Registered: Jul 2007
Distribution: archlinux, ubuntu, slackware
Posts: 58

Original Poster
Rep: Reputation: 15
I believe the only problem was that xanderbox didn't have IP forwarding enabled!

Everything works now (internet connection from laptop)...

Thanks for the help everyone!
 
Old 10-19-2008, 10:12 AM   #10
corteplaneta
Member
 
Registered: Jul 2007
Distribution: archlinux, ubuntu, slackware
Posts: 58

Original Poster
Rep: Reputation: 15
Ok, sorry to bring back an old post I thought solved, but for some reason everything DOES work, but stops working after some time? If I restart my main desktop PC, everything begins to work correctly again? Does anyone have any idea why this would happen?
 
Old 10-19-2008, 10:26 AM   #11
keefaz
Senior Member
 
Registered: Mar 2004
Distribution: Slackware
Posts: 4,436

Rep: Reputation: 93
Maybe check logs on Desktop PC, especially /var/log/syslog
 
Old 10-20-2008, 10:02 PM   #12
corteplaneta
Member
 
Registered: Jul 2007
Distribution: archlinux, ubuntu, slackware
Posts: 58

Original Poster
Rep: Reputation: 15
Oct 19 16:18:43 xanderbox last message repeated 24 times
Oct 19 16:18:43 xanderbox kernel: eth1: (40770) System Error occurred (0)

This can't be good!
 
  


Reply

Tags
cable, connection, crossover, ics, internet, linux, routing, sharing


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Packet Routing/Forwarding/Whatever Setup Help kromberg Linux - Networking 2 01-18-2008 04:24 PM
Internet Connection Sharing / Routing in Linux nirj Linux - Networking 1 10-07-2007 01:28 AM
packet cloning and routing with single NIC gianman Linux - Networking 0 11-10-2006 10:33 AM
Internet Connection Sharing and Routing Troubleshooting axelfc Linux - Networking 3 01-27-2006 07:57 AM
Halted packet filtering+routing+shaping router or bridge? Norel Linux - Networking 0 05-02-2002 06:43 AM


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

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration