2

The wireless component of my router started suddenly flaking and dropping connections, so I improvised a WAP from an old netbook, wired to this router. I'm very ignorant about networking so I'm sure there's a misunderstanding on my part, but while devices on the WAP can reach the whole network, I can't figure out how to reach them from the wired devices. The LAN looks something like this:

--------------------
|      ROUTER      |
|    192.168.1.1   |
--------------------
   |    |  |  |  |
Modem   A  B  C  |
                 |
         -----------------
         |      D (WAP)  |
         |  192.168.1.22 |
         |  192.168.45.1 |
         -----------------
            _    _    _
            =    =    = 
            E    F    G

Devices A, B and C are in the 192.168.1.x IP range. Wireless devices E, F and G are on 192.168.45.x.

So if I ping A from E, I get a response. According to wireshark, though, the ping originates from 192.168.1.22. E is unreachable when pinged from A on its .45.x address.

/etc/udhcpd.conf:

start 192.168.45.2 
end 192.168.45.18
interface wlan0
remaining yes
opt dns 192.168.1.1 8.8.8.8
opt subnet 255.255.255.0
opt router 192.168.45.1
opt lease 864000

/etc/hostapd/hostapd.conf:

interface=wlan0
ssid=MYWAP
hw_mode=g
channel=6
auth_algs=1
wmm_enabled=0
wpa=2
wpa_passphrase=mypassword
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

/etc/network/interfaces:

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
        address 192.168.1.22
        netmask 255.255.255.0
        network 192.168.1.0
        broadcast 192.168.1.255
        gateway 192.168.1.1

iface wlan0 inet static
  address 192.168.45.1
  netmask 255.255.255.0

up iptables-restore < /etc/iptables.ipv4.nat

IP forwarding script goes like this:

sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
echo 'net.ipv4.ip_forward=1' > /etc/sysctl.conf
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth0 -o wlan0 -m state --state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i wlan0 -o eth0 -j ACCEPT

sh -c "iptables-save > /etc/iptables.ipv4.nat"

I've tried setting up a static route on the modem-connected router, with no success:

Destination LAN IP: 192.168.45.0
Subnet Mask:        255.255.255.0
Default Gateway:    192.168.1.22
Interface:          LAN & Wireless

Is there any way to easily normalize network discovery so that wireless printers, etc, connected to the WAP can be used by the wired devices? Am I going about this wrong? Can I somehow put them all on the same subnet and leave the DHCP functionality to the original router?

2
  • @Reaces - it's not a business environment, just a multi-purpose headless server I use for development and a bunch of other things
    – Greg
    Commented Mar 6, 2015 at 8:50
  • 1
    Why don't you put everything on 192.168.1.x and avoid all this headache?
    – harrymc
    Commented Mar 18, 2015 at 6:27

3 Answers 3

2
+100

Is there any way to easily normalize network discovery so that wireless printers, etc, connected to the WAP can be used by the wired devices? Am I going about this wrong? Can I somehow put them all on the same subnet and leave the DHCP functionality to the original router?

I think you answered your own question. Typically auto discovery relies on broadcast packets that don't cross between subnets - Espically when it comes to anything samba related. Honestly, if you want all your devices to behave as if they are on the same network, then you should probably have them all in the same network.

If you want to go this route (And I think it's the most appropriate solution given the requirements) you'll need to bridge the wired and wireless connections of the laptop.

Debian has a package that will do this for you..

apt-get install bridge-utils

Once you install this you'll have to create the bridge using the command

brctl addbr br0

This creates a bridge interface that you will assign your other interfaces to.

But before you can do this you'll have to take the interfaces down and remove their ip addresses (they will share a single address later)...

ifconfig eth0 0.0.0.0 down
ifconfig wlan0 0.0.0.0 down

Join the interfaces to the bridge connection we created earlier with

brctl addif br0 eth0
brctl addif br0 wlan0

Finally, Bring the interfaces up

ifconfig eth0 up
ifconfig wlan0 up
ifconfig br0 up

This should start the flow of information between the interfaces in about 2-3 mins. If you also need the laptop itself to communicate on the bridge, you should assign a ipaddress to the bridge interface.

ifconfig br0 192.168.1.22

Just FYI - Wireless interfaces can sometimes be picky about forwarding broadcast packets, and it really depends on your hardware. But I would give this a shot and see if this will work for you.

2

Use the following process:

  • Use the device as a bridge between your wired network and wireless network
  • Download the bridge_utils package
  • Use brctl to set up the bridge between the two devices

    /usr/sbin/brctl addbr br0 
    /sbin/ifconfig br0 up 
    /usr/sbin/brctl addif br0 eth0
    /usr/sbin/brctl addif br0 wlan0
    /sbin/ifconfig br0 192.168.1.101
    /sbin/ip route add default gw 192.168.1.1
    /usr/sbin/dhcpd wlan0_0
    

References

0

The problem as you state it is for discovery across different subnets.

To address your problem as is, you should ensure that the computer browser service is enabled on your systems. You could also probably setup a WINS server to address as well.

To enable computer browser service for instance in Windows 7 run services.msc, select computer browser, and set to automatic start.

Bridging would remove the different subnets and would probably address the root of your problem if you're willing to just have one subnet. But if the existence of subnets is a problem constraint, that can't be done.

There is a nice little article at microsoft on the computer browser service. See https://technet.microsoft.com/en-us/library/cc737661%28v=ws.10%29.aspx. It covers a few cases including computer browser service across router separated subnets. Good article. For instance it recommends against forwarding NetBIOS broadcasts across the router. Even so if you're still having issues that may be something further to try.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .