Skip to content
Advertisement

eth0 (modem usb) and wlan0 (wifi module) interconnection

I’m trying to either make a bridge between eth0 (Usb modem) and wlan0 (Wifi Hotspot) or route all traffic from wlan0 to eth0.

Procedure:

Bridge won’t be successful if the interfaces already have an ip.

JavaScript

Create the bridge and add the network.

JavaScript

Start the wifi hotspot. At this point I can see the network with my phone.

JavaScript

Assign the bridge an ip.

JavaScript

Start dhcp-server so my hotspot can automatically assign an ip address to the connected devices.

JavaScript

Reset my bridge.

JavaScript

Configuration files

hostapd.conf:

JavaScript

/etc/network/interfaces:

JavaScript

/etc/dhcp/dhcp.conf

JavaScript

The dhcp-server returned OK but when I try to connect to the wifi hotspot I can’t get an ip. Any ideas on how to proceed?

Advertisement

Answer

I finally managed to get it done. I didn’t use bridge but iptables.

Just these two commands were enough:

echo 1 > /proc/sys/net/ipv4/ip_forward

iptables -t nat -A POSTROUTING -o eth0 -s 192.168.0.1/24 -j MASQUERADE

Here is the source of the answer with the explanation

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement