You are not logged in.

#1 2018-08-18 16:20:13

definitellynotspammer
Member
Registered: 2016-06-07
Posts: 53

Bridge wlan0 with eth0 for internet sharing (without NAT) - bridging

Consider this is my setup:

WiFi <--------------> PC0 <--------------> PC1

------------------------------------------------------------------------------------

PC0 has 2 interfaces - wlan0 and eth0:
* WiFi connected to PC0 via wlan0 interface.
* PC1 connected to PC0 via eth0 interface.

------------------------------------------------------------------------------------

Because WiFi has DHCP server enabled and providing IP addresses to every devices connected to it, I want PC1 to automatically have internet connection as well as getting IP address from WiFi. So basically I want PC0 to act like a switch.

Question - is it even possible? Currently I am using NAT in PC0 for internet sharing, but I want to have just a single network, not 2 networks.

I've seen this article, but when I assign wlan0 interface to bridge - it looses IP addresses and connectivity, but actually I need that connectivity. Also, I need PC0 to be accessible from WiFi and PC1.

Would be amazing if someone could share tutorial or commands to achieve this.

Offline

#2 2018-08-19 13:22:51

lo1
Member
Registered: 2017-09-25
Posts: 584

Re: Bridge wlan0 with eth0 for internet sharing (without NAT) - bridging

You can't use your PC as if it was a real switch, but if it's ok to keep your setup and add to it your dhcp server, you can get close to it by:

- enable UDP 53 / TCP 67 forwarding
- use dnsmasq and configure dhcp relay functionalities

read `man dnsmasq` and look for "--dhcp-relay"

P.S. wouldn't it be better to buy an inexpensive wifi usb key to get rid of these complexities?

Offline

#3 2018-08-19 13:36:04

damjan
Member
Registered: 2006-05-30
Posts: 451

Re: Bridge wlan0 with eth0 for internet sharing (without NAT) - bridging

To enable bridging with a wireless interface you need to enabled the WDS (or also known as 4addr) mode on the wireless interface. It also needs to be supported on your router (typically called WDS mode).

The command for that is `/usr/bin/iw dev  wlan0 set 4addr on`, which I have set in an udev rule:

# /etc/udev/rules.d/91-wifi-4addr-mode.rules 
ACTION=="add", SUBSYSTEM=="net", ATTRS{idVendor}=="0cf3", ATTRS{idProduct}=="9271", RUN+="/usr/bin/iw dev $name set 4addr on"

note that the wifi driver needs to support this

Offline

#4 2018-08-19 13:37:58

definitellynotspammer
Member
Registered: 2016-06-07
Posts: 53

Re: Bridge wlan0 with eth0 for internet sharing (without NAT) - bridging

Thank you very much for pointing me to the right direction! Will come back here once I figure everything out or get stuck somewhere. Thanks a lot!

Offline

Board footer

Powered by FluxBB