pertm84
Posts: 29
Joined: Sat Oct 20, 2018 10:59 am
Location: Norway

Re: [SOLVED] Bridge wlan0 and eth0 - help needed

Mon Oct 22, 2018 12:53 pm

SurferTim wrote:
Mon Oct 22, 2018 11:30 am
What is the IP/netmask on the computer that you are using to connect to the RPi?

Edit /etc/sysctl.conf and uncomment

Code: Select all

net.ipv4.ip_forward=1
The IP on my computer is 192.168.1.101. with 255.255.255.0
I tried to uncomment the line in sysctl.conf and rebooted now, but I still get the "Connection Refused"

But the br0: Expired IPv4LL from the above screenshot is not displayed anymore.

EDIT: When I run ifconfig on the Pi I get this:

Code: Select all

br0 flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.125 netmask 255.255.255.0 broadcast 192.168.1.255
.. etc

lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
.. etc
..
no IPs on wlan0 or et0
..
.

Could the cause of error be the br0 inet 192.168.1.125 netmask 255.255.255.0 broadcast 192.168.1.255 ?
Last edited by pertm84 on Mon Oct 22, 2018 1:03 pm, edited 1 time in total.

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: [SOLVED] Bridge wlan0 and eth0 - help needed

Mon Oct 22, 2018 1:00 pm

Is the RPi getting network settings from a dhcp server? Normally, a "connection refused" message indicates there is no ssh daemon running on the destination device, or the firewall is preventing a connection.

Are you certain there is no other device using that IP?

pertm84
Posts: 29
Joined: Sat Oct 20, 2018 10:59 am
Location: Norway

Re: [SOLVED] Bridge wlan0 and eth0 - help needed

Mon Oct 22, 2018 1:07 pm

SurferTim wrote:
Mon Oct 22, 2018 1:00 pm
Is the RPi getting network settings from a dhcp server? Normally, a "connection refused" message indicates there is no ssh daemon running on the destination device, or the firewall is preventing a connection.

Are you certain there is no other device using that IP?
I just double-checked my wireless router which acts as the dhcp, there is only one connection on that address and that is the "raspberrypi".
Also I have not touched the firewall settings, and I have managed to get this setup up and running a couple of weeks ago :/

But could the cause of error be the br0 inet 192.168.1.125 netmask 255.255.255.0 broadcast 192.168.1.255 ?

SurferTim
Posts: 1769
Joined: Sat Sep 14, 2013 9:27 am
Location: Miramar Beach, Florida

Re: [SOLVED] Bridge wlan0 and eth0 - help needed

Mon Oct 22, 2018 1:30 pm

What about the computer you are attempting to connect with? It doesn't show up as a dhcp lease? How does it get its IP?

Edit: Is your computer connected by ethernet or wifi?

pertm84
Posts: 29
Joined: Sat Oct 20, 2018 10:59 am
Location: Norway

Re: [SOLVED] Bridge wlan0 and eth0 - help needed

Mon Oct 22, 2018 2:07 pm

SurferTim wrote:
Mon Oct 22, 2018 1:30 pm
What about the computer you are attempting to connect with? It doesn't show up as a dhcp lease? How does it get its IP?

Edit: Is your computer connected by ethernet or wifi?
I am not sure if I understand what you are asking, but my setup is as follows:
iMac (192.168.1.101) is connected through WiFi to Asus wirelessrouter (192.168.1.100) and my Pi (192.168.1.125) is connected with ethernet to the same Asus router (192.168.1.100). This Asus router handles the dhcp and delegates the IPs. It is also on this router I have set a static ip for the PI (based on MAC address).

The thing is, I have not changed my setup since I managed to get this to work earlier. I have checked through all of the files, and I can not understand why it is not working.

pertm84
Posts: 29
Joined: Sat Oct 20, 2018 10:59 am
Location: Norway

Re: [SOLVED] Bridge wlan0 and eth0 - help needed

Mon Oct 22, 2018 4:48 pm

pertm84 wrote:
Mon Oct 22, 2018 2:07 pm
SurferTim wrote:
Mon Oct 22, 2018 1:30 pm
What about the computer you are attempting to connect with? It doesn't show up as a dhcp lease? How does it get its IP?

Edit: Is your computer connected by ethernet or wifi?
I am not sure if I understand what you are asking, but my setup is as follows:
iMac (192.168.1.101) is connected through WiFi to Asus wirelessrouter (192.168.1.100) and my Pi (192.168.1.125) is connected with ethernet to the same Asus router (192.168.1.100). This Asus router handles the dhcp and delegates the IPs. It is also on this router I have set a static ip for the PI (based on MAC address).

The thing is, I have not changed my setup since I managed to get this to work earlier. I have checked through all of the files, and I can not understand why it is not working.
OK, I figured it out! I'm so sorry for spending your time @SurferTim!

I had edited the sshd_config file to PermitRootLogin password prohibited!.
I did this to be able to sftp some files over to the root folders. I thought this was on the previous installation, and that I had formated the SDcard since then. It seems I had not. I changed the PermitRootLogin to no, and now it works perfectly!

Thank you very much for the help though! I can now understand why we couldn't figure out what was wrong. Hopefully, this can help someone else who has been snooping around int the ssh or sshd_config file!

Pikach
Posts: 2
Joined: Thu Oct 03, 2019 12:08 pm

Re: Bridge wlan0 and eth0 - help needed

Thu Oct 03, 2019 12:10 pm

AndriusWild wrote:
Tue Sep 26, 2017 5:13 pm
I finally got my network working.
It turned out the issues I had with the client 192.168.0.222 were caused by "DHCP and Static" setting on the client.
Since Pi acts as DHCP server it changed the default address 192.168.0.222 to 192.168.0.214 after plugging the device in the network and I did not notice that. I switched the device to fully static IP mode and that solved the problem.
Special thanks to SurferTim for the amazing tech support! :!: :) :) :)
Here is all the steps I did:
-----------------------------------------------------------------------------------
Created: 2017-09-26
Raspbian Stretch Release 2.1 - September 2017
------------------------------------------------------------------------------------

Install the following packages before your break your internet connection:

Code: Select all

sudo apt-get install dnsmasq hostapd bridge-utils
Stop the services:

Code: Select all

sudo systemctl stop dnsmasq
sudo systemctl stop hostapd
Create bridge br0:

Code: Select all

sudo brctl addbr br0
Create file /etc/hostapd/hostapd.conf

Code: Select all

interface=wlan0
bridge=br0
#driver=nl80211
ssid=RPiNet
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=mypassphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Edit /etc/default/hostapd, uncomment and change this:

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"
Add eth0 to br0:

Code: Select all

sudo brctl addif br0 eth0
Edit /etc/network/interfaces and add this:

Code: Select all

auto br0
iface br0 inet manual
bridge_ports eth0 wlan0
Edit /etc/dhcpcd.conf and add this above other interfaces:

Code: Select all

denyinterfaces eth0 wlan0
Reboot then add this to /etc/dhcpcd.conf

Code: Select all

interface br0
static ip_address=192.168.0.1/24
Move the original dnsmasq.conf

Code: Select all

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
Open a new dnsmasq.conf

Code: Select all

sudo nano /etc/dnsmasq.conf
and add this:

Code: Select all

interface=br0
dhcp-range=192.168.0.20,192.168.0.50,255.255.255.0,24h
Start the services:

Code: Select all

sudo service hostapd start  
sudo service dnsmasq start
Add routing and masquerade

Edit /etc/sysctl.conf and uncomment this line:

Code: Select all

net.ipv4.ip_forward=1
Add a masquerade for outbound traffic on eth0:

Code: Select all

sudo iptables -t nat -A  POSTROUTING -o eth0 -j MASQUERADE
Save the iptables rule:

Code: Select all

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
Edit /etc/rc.local and add this just above "exit 0" to install these rules on boot:

Code: Select all

iptables-restore < /etc/iptables.ipv4.nat
Insure there is no router (dhcp server) on the localnets.
Reboot. Disconnect and reconnect your localnet computers to the network.
All your wlan and eth devices should show an IP between 192.168.0.20 and 192.168.0.50.
No internet connection though.
Hi,
I did all of this but only google.com and wikipedia.com are reachable for other site there is a problem of DNS I think

Pikach
Posts: 2
Joined: Thu Oct 03, 2019 12:08 pm

Re: Bridge wlan0 and eth0 - help needed

Fri Oct 04, 2019 6:03 am

AndriusWild wrote:
Tue Sep 26, 2017 5:13 pm
I finally got my network working.
It turned out the issues I had with the client 192.168.0.222 were caused by "DHCP and Static" setting on the client.
Since Pi acts as DHCP server it changed the default address 192.168.0.222 to 192.168.0.214 after plugging the device in the network and I did not notice that. I switched the device to fully static IP mode and that solved the problem.
Special thanks to SurferTim for the amazing tech support! :!: :) :) :)
Here is all the steps I did:
-----------------------------------------------------------------------------------
Created: 2017-09-26
Raspbian Stretch Release 2.1 - September 2017
------------------------------------------------------------------------------------

Install the following packages before your break your internet connection:

Code: Select all

sudo apt-get install dnsmasq hostapd bridge-utils
Stop the services:

Code: Select all

sudo systemctl stop dnsmasq
sudo systemctl stop hostapd
Create bridge br0:

Code: Select all

sudo brctl addbr br0
Create file /etc/hostapd/hostapd.conf

Code: Select all

interface=wlan0
bridge=br0
#driver=nl80211
ssid=RPiNet
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=mypassphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Edit /etc/default/hostapd, uncomment and change this:

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"
Add eth0 to br0:

Code: Select all

sudo brctl addif br0 eth0
Edit /etc/network/interfaces and add this:

Code: Select all

auto br0
iface br0 inet manual
bridge_ports eth0 wlan0
Edit /etc/dhcpcd.conf and add this above other interfaces:

Code: Select all

denyinterfaces eth0 wlan0
Reboot then add this to /etc/dhcpcd.conf

Code: Select all

interface br0
static ip_address=192.168.0.1/24
Move the original dnsmasq.conf

Code: Select all

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
Open a new dnsmasq.conf

Code: Select all

sudo nano /etc/dnsmasq.conf
and add this:

Code: Select all

interface=br0
dhcp-range=192.168.0.20,192.168.0.50,255.255.255.0,24h
Start the services:

Code: Select all

sudo service hostapd start  
sudo service dnsmasq start
Add routing and masquerade

Edit /etc/sysctl.conf and uncomment this line:

Code: Select all

net.ipv4.ip_forward=1
Add a masquerade for outbound traffic on eth0:

Code: Select all

sudo iptables -t nat -A  POSTROUTING -o eth0 -j MASQUERADE
Save the iptables rule:

Code: Select all

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
Edit /etc/rc.local and add this just above "exit 0" to install these rules on boot:

Code: Select all

iptables-restore < /etc/iptables.ipv4.nat
Insure there is no router (dhcp server) on the localnets.
Reboot. Disconnect and reconnect your localnet computers to the network.
All your wlan and eth devices should show an IP between 192.168.0.20 and 192.168.0.50.
No internet connection though.
Hi,

Fyi in the documentation https://www.raspberrypi.org/documentati ... s-point.md they forget to add the command to enable systemd-networkd (it's stopped after reboot if not enable).
With this extra step it's working fine

iznobe
Posts: 287
Joined: Sun Feb 05, 2017 4:14 pm
Location: Avignon , FRANCE

Re: Bridge wlan0 and eth0 - help needed

Wed Oct 30, 2019 6:31 pm

AndriusWild wrote:
Tue Sep 26, 2017 5:13 pm
I finally got my network working.
It turned out the issues I had with the client 192.168.0.222 were caused by "DHCP and Static" setting on the client.
Since Pi acts as DHCP server it changed the default address 192.168.0.222 to 192.168.0.214 after plugging the device in the network and I did not notice that. I switched the device to fully static IP mode and that solved the problem.
Special thanks to SurferTim for the amazing tech support! :!: :) :) :)
Here is all the steps I did:
-----------------------------------------------------------------------------------
Created: 2017-09-26
Raspbian Stretch Release 2.1 - September 2017
------------------------------------------------------------------------------------

Install the following packages before your break your internet connection:

Code: Select all

sudo apt-get install dnsmasq hostapd bridge-utils
Stop the services:

Code: Select all

sudo systemctl stop dnsmasq
sudo systemctl stop hostapd
Create bridge br0:

Code: Select all

sudo brctl addbr br0
Create file /etc/hostapd/hostapd.conf

Code: Select all

interface=wlan0
bridge=br0
#driver=nl80211
ssid=RPiNet
hw_mode=g
channel=7
wmm_enabled=0
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=mypassphrase
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
Edit /etc/default/hostapd, uncomment and change this:

Code: Select all

DAEMON_CONF="/etc/hostapd/hostapd.conf"
Add eth0 to br0:

Code: Select all

sudo brctl addif br0 eth0
Edit /etc/network/interfaces and add this:

Code: Select all

auto br0
iface br0 inet manual
bridge_ports eth0 wlan0
Edit /etc/dhcpcd.conf and add this above other interfaces:

Code: Select all

denyinterfaces eth0 wlan0
Reboot then add this to /etc/dhcpcd.conf

Code: Select all

interface br0
static ip_address=192.168.0.1/24
Move the original dnsmasq.conf

Code: Select all

sudo mv /etc/dnsmasq.conf /etc/dnsmasq.conf.orig
Open a new dnsmasq.conf

Code: Select all

sudo nano /etc/dnsmasq.conf
and add this:

Code: Select all

interface=br0
dhcp-range=192.168.0.20,192.168.0.50,255.255.255.0,24h
Start the services:

Code: Select all

sudo service hostapd start  
sudo service dnsmasq start
Add routing and masquerade

Edit /etc/sysctl.conf and uncomment this line:

Code: Select all

net.ipv4.ip_forward=1
Add a masquerade for outbound traffic on eth0:

Code: Select all

sudo iptables -t nat -A  POSTROUTING -o eth0 -j MASQUERADE
Save the iptables rule:

Code: Select all

sudo sh -c "iptables-save > /etc/iptables.ipv4.nat"
Edit /etc/rc.local and add this just above "exit 0" to install these rules on boot:

Code: Select all

iptables-restore < /etc/iptables.ipv4.nat
Insure there is no router (dhcp server) on the localnets.
Reboot. Disconnect and reconnect your localnet computers to the network.
All your wlan and eth devices should show an IP between 192.168.0.20 and 192.168.0.50.
No internet connection though.
hello , i would like to do exactly same thing as you ,

i have raspbian stretch on my pi up to date , i ve done all you says on the quote , but it is not working for me :roll:

i ' don't have router in my network . so the pi must work as DHCP server on ethernet and wifi , could you help me please ?

Code: Select all

[email protected]:~ $ ifconfig
br0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.1.254  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::b0d0:6076:f649:322c  prefixlen 64  scopeid 0x20<link>
        ether b8:27:eb:8f:c7:b4  txqueuelen 1000  (Ethernet)
        RX packets 282117  bytes 12980106 (12.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 54  bytes 8479 (8.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether b8:27:eb:da:92:e1  txqueuelen 1000  (Ethernet)
        RX packets 282117  bytes 12980106 (12.3 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 54  bytes 9051 (8.8 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Boucle locale)
        RX packets 480  bytes 34400 (33.5 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 480  bytes 34400 (33.5 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        ether b8:27:eb:8f:c7:b4  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 58205  bytes 4889588 (4.6 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
[email protected]:~ $ sudo brctl show
bridge name     bridge id               STP enabled     interfaces
br0             8000.b827eb8fc7b4       no              eth0
                                                        wlan0
[email protected]:~ $

actually , i can't connect to pi wifi , help please .

EDIT : it seems to be working now , but i don't know why ...

Return to “Troubleshooting”