LinuxQuestions.org
Review your favorite Linux distribution.
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 05-19-2009, 03:42 PM   #1
danielsbrewer
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Rep: Reputation: 0
Wired network to wireless problem


Hello,

I have an ubuntu box with both a wireless and wired interface and I would like to use it to allow my XBMC xbox to connect to the internet.

This is he setup

Internet ---- Wireless router (192.168.0.1) ---- wlan0 ubuntu box eth0 ---- xbox

wlan0: inet addr:192.168.0.8 Bcast:192.168.0.255 Mask:255.255.255.0
eth0: inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0
xbox: inet addr:192.168.2.2 Bcast:192.168.2.255 Mask:255.255.255.0

Here is the route table for the ubuntu box:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0
192.168.0.0     *               255.255.255.0   U     0      0        0 wlan0
link-local      *               255.255.0.0     U     1000   0        0 wlan0
default         tomato.brewer.m 0.0.0.0         UG    100    0        0 wlan0
The ubuntu box can access the internet/wireless router fine.

The xbox can ping 192.168.2.1 successfully but fails when trying to ping 192.168.0.1.

/etc/network/interfaces looks like this:
Code:
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
address 192.168.0.8
netmask 255.255.255.0
gateway 192.168.0.1
wireless-essid BrewerNet
wireless-key 63B6F3***************695CC
wireless-channel 9
wireless-mode managed

auto eth0
iface eth0 inet static
address 192.168.2.1
netmask 255.255.255.0
gateway 192.168.0.1
I couldn' get the routing info from the xbox, so I plugged in a laptop setup in the same way. Here is the info:
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     *               255.255.255.0   U     0      0        0 eth0
default         192.168.2.1     0.0.0.0         UG    0      0        0 eth0
Interestingly, it took a long time for the default line to appear.

Ping successful: 192.168.2.2, 192.168.2.1, 192.168.0.8
Ping unsuccessful: 192.168.0.1, 208.67.222.222 (opendns)

The router is running the tomato firmware.

Many thanks for looking at this I am at a complete loss.

I cannot ping 192.168.2.1 from the router (192.168.0.1)

On ubuntu box the firewall is clear:
Code:
 sudo iptables -S
-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
Could you tell me where I am going wrong?
 
Old 05-19-2009, 04:19 PM   #2
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Did you set packet forwarding on?
Code:
sysctl 'net.ipv4.ip_forward=1'
 
Old 05-20-2009, 01:17 AM   #3
danielsbrewer
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
That wasn't set. But when I do set it, it doesn't make any difference to the results. The thing I don't get is I can ping 192.168.0.8 (the other nic in the ubuntu box) from the "xbox" so it is crossing networks somehow.
 
Old 05-20-2009, 08:46 PM   #4
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Since you are not NATting your xbox, your router has no idea how to reach it.

If you can, ssh into your router and add a static route:
Code:
route add -net 192.168.2.0 netmask 255.255.255.0 gw 192.168.0.8
You could replace 192.168.0.8 with a hostname if you have an internal DNS setup. Otherwise, make sure that your ubuntu box gets assigned the same IP address (either set it statically or let the dhcp server on the router prefer tie your MAC address to 192.168.0.8). Now, from your ssh session, you should try to ping first your ubuntu box’s wired NIC, then your xbox.

If you are unable to setup manual routes on your wireless router (but you should be able to since you said you use the tomato firmware), you can set up your ubuntu box to NAT or MASQUERADE your xbox with iptables. There are plenty of guides on how to do this online.
 
Old 05-21-2009, 02:06 AM   #5
danielsbrewer
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
OK. That's really helpful and got me one step closer. So I have added the additional route on the router and now the router's route table looks like this
Code:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.2.0     192.168.0.8     255.255.255.0   UG    0      0        0 br0
192.168.1.0     *               255.255.255.0   U     0      0        0 vlan1
192.168.0.0     *               255.255.255.0   U     0      0        0 br0
127.0.0.0       *               255.0.0.0       U     0      0        0 lo
default         speedtouch.lan  0.0.0.0         UG    0      0        0 vlan1
From the router I can now ping the ubuntu box on the other nic (192.168.2.1) but cannot ping the xbox (192.168.2.2).

From the xbox I can ping 192.168.0.8 but not 192.168.0.1.

Any ideas? If not I will have a look at masquerading.

Thanks
 
Old 05-21-2009, 07:59 PM   #6
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by danielsbrewer View Post
Any ideas?
From what you have posted so far, everything should be working (unless I am not seeing something very obvious). One thing that puzzle’s me in your /etc/network/interfaces file, you have:
Code:
auto eth0
iface eth0 inet static
address 192.168.2.1
netmask 255.255.255.0
gateway 192.168.0.1
I am not very familiar with Debian/Ubuntu network configuration files, but I do not see the necessity of that last line. Regardless, if it caused trouble, it should show up in the routing table (btw, you might get a more detailed routing table if you use iproute2—i.e., “ip route”). Also, out of curiosity, what is the 192.168.1.0/24 network which is referenced in your routing table?

Another possibility is that forwarding was disabled on reboot (The command that I posted before only changes the packet forwarding for the current running kernel. Once you reboot, it is reset to 0). Check the output of “cat /proc/sys/net/ipv4/ip_forward” on the ubuntu computer (make sure the output is 1 and not 0). Various distros/startup schemes have ways of making the option persistent across reboots, usually by an entry in a file named /etc/sysctl.conf or similar.

It is strange that you do not have access to the routing table of the xbox. Is the interface configured through DHCP with a server you run on the ubuntu machine? Did you try using the substitute laptop as a test after you made all the changes?

If you cannot get ip forwarding working in the first place (and since you modified the routing table, it should have a clear route to host), I do not think that masquerading will work either (as it ends up doing forwarding).
 
Old 05-24-2009, 03:01 PM   #7
danielsbrewer
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
Sorry for the delaying getting back to you. The 192.168.1.* network is because confusingly I have my ADSL modem in another router, so that is:

192.168.1.1 ADSL modem - 192.168.1.3 tomato router 192.168.0.1 - the rest as before

That shouldn't make a difference though should it?

I commented out the extra defaul line and it made no difference.

So here is the output from "ip route":

tomato router:-
Code:
192.168.2.0/24 via 192.168.0.8 dev br0 
192.168.1.0/24 dev vlan1  proto kernel  scope link  src 192.168.1.3 
192.168.0.0/24 dev br0  proto kernel  scope link  src 192.168.0.1 
127.0.0.0/8 dev lo  scope link 
default via 192.168.1.1 dev vlan1
Ubuntu box:-
Code:
192.168.2.0/24 dev eth0  proto kernel  scope link  src 192.168.2.1 
192.168.0.0/24 dev wlan0  proto kernel  scope link  src 192.168.0.8 
169.254.0.0/16 dev wlan0  scope link  metric 1000 
default via 192.168.0.1 dev wlan0  metric 100
"xbox":-
Code:
192.168.2.0/24 dev eth0  proto kernel  scope link  src 192.168.2.2 
default via 192.168.2.1 dev eth0
I am using XBMC on xbox rather than linux and so I don't think you can get shell access from that. All tests were done on the laptop, if I can get the laptop working then I will be happy!

I have changed the /etc/sysctl.conf to always set the forwarding. Still no joy.

The only thing I can think of is that the kernel in ubuntu does not have the right modules to do forwarding. Could this be right?
 
Old 05-26-2009, 06:50 PM   #8
osor
HCL Maintainer
 
Registered: Jan 2006
Distribution: (H)LFS, Gentoo
Posts: 2,450

Rep: Reputation: 78
Quote:
Originally Posted by danielsbrewer View Post
The only thing I can think of is that the kernel in ubuntu does not have the right modules to do forwarding. Could this be right?
I doubt it (almost all distros have this enabled by default). Try looking at the the output of “grep IP_ADVANCED_ROUTER /boot/config-`uname -r`” or “zgrep IP_ADVANCED_ROUTER /proc/config.gz” to be sure. Also, even though you currently have a clear iptables on your ubuntu machine, you might unload all netfilter modules, just to make sure it is not causing any problems.

The only other thing I can think of is that you have some iptables rules on the tomato machine which will drop anything that is not on its list of managed subnets. This is unlikely, since there are no rules preventing the ability to ping 192.168.2.1 from the tomato.

I don’t know what else to say you except that AFAICT, it should work. You might be able to see what’s going on better by using tcpdump on the ubuntu machine during a failed ping.

As I said before, you could attempt to NAT the xbox, but since simple forwarding (which is pretty much a prerequisite of NAT) is not working, I don’t see how this would be successful.
 
Old 05-27-2009, 03:57 AM   #9
danielsbrewer
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
So IP_ADVANCED_ROUTER is enabled in the kernel. I tried doing masquerading, still without joy as you expected. So possible areas where the problem could be:
1) tomato firmware.
2) Something to do with the USB wireless interface not bridging.

ho hum.
 
Old 05-28-2009, 03:58 PM   #10
danielsbrewer
LQ Newbie
 
Registered: Aug 2007
Posts: 18

Original Poster
Rep: Reputation: 0
Problem solved.

It was a firewall issue on the ubuntu box. When I was listing the iptables and I thought it was clear I wasn't listening the "extra" tables. I was using moblock which was blocking the forwarding of traffic.

Thanks for all your help and sorry I didn't pick up on it earlier.
 
  


Reply

Tags
interfaces, network, two


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
bridging a wireless and wired network causes wired to stop working royce2020 Linux - Networking 0 04-21-2009 04:48 PM
wireless network or wired rich345 Linux - Laptop and Netbook 1 12-07-2008 08:59 AM
Bridging a wired network to a (managed by network manager) wireless one jemenake Linux - Wireless Networking 2 09-09-2008 09:18 PM
Network Manager issue : Does not distinguish between wired and wireless network rohanak Linux - Laptop and Netbook 1 09-04-2008 04:49 PM
Linking a wired network to a wireless network gothgeek84 Linux - Wireless Networking 3 08-08-2005 02:38 PM

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

All times are GMT -5. The time now is 12:37 PM.

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