Мост wifi ethernet linux

Ubuntu 18.04 netplan create bridge from wifi to ethernet

I am running ubuntu 18.04 and do not have much experience with networking. This ubuntu server runs on our robot and is supposed to act as a wireless to lan bridge for the rest of the wired modules on the robot. I have been using dd-wrt routers previously in client bridge mode to achieve the same, but they are too inconsistent. An off the shelf extender with ethernet ports is a little expensive and hence i wanted to try this out. I have configured the wireless interface using netplan. Following are the network interfaces on my server, enp2s0 is the ethernet interface and wlp3s0 is the wifi interface:

br0: flags=4163 mtu 1500 inet 192.168.0.10 netmask 255.255.255.0 broadcast 192.168.0.255 inet6 fe80::7c0d:f9ff:feb1:68ba prefixlen 64 scopeid 0x20 ether 7e:0d:f9:b1:68:ba txqueuelen 1000 (Ethernet) RX packets 3 bytes 138 (138.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 39 bytes 5047 (5.0 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 docker0: flags=4163 mtu 1500 inet 192.168.9.1 netmask 255.255.255.0 broadcast 192.168.9.255 inet6 fe80::42:a6ff:fee9:59a4 prefixlen 64 scopeid 0x20 ether 02:42:a6:e9:59:a4 txqueuelen 0 (Ethernet) RX packets 1115 bytes 84610 (84.6 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 843 bytes 77266 (77.2 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 eno1: flags=4099 mtu 1500 inet 169.254.32.1 netmask 255.255.255.0 broadcast 169.254.32.255 ether fc:aa:14:e3:e4:96 txqueuelen 1000 (Ethernet) RX packets 0 bytes 0 (0.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 0 bytes 0 (0.0 B) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 device interrupt 20 memory 0xf7e00000-f7e20000 enp2s0: flags=4163 mtu 1500 inet 192.168.0.64 netmask 255.255.255.0 broadcast 192.168.0.255 ether fc:aa:14:e3:e4:94 txqueuelen 1000 (Ethernet) RX packets 3 bytes 180 (180.0 B) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 216 bytes 14171 (14.1 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 lo: flags=73 mtu 65536 inet 127.0.0.1 netmask 255.0.0.0 inet6 ::1 prefixlen 128 scopeid 0x10 loop txqueuelen 1000 (Local Loopback) RX packets 50687 bytes 11888298 (11.8 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 50687 bytes 11888298 (11.8 MB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 vethea1fda5: flags=4163 mtu 1500 inet6 fe80::94b1:bcff:fe80:d58e prefixlen 64 scopeid 0x20 ether 96:b1:bc:80:d5:8e txqueuelen 0 (Ethernet) RX packets 558 bytes 50143 (50.1 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 486 bytes 45921 (45.9 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 vethf80ef47: flags=4163 mtu 1500 inet6 fe80::d419:a5ff:fe1d:fb02 prefixlen 64 scopeid 0x20 ether d6:19:a5:1d:fb:02 txqueuelen 0 (Ethernet) RX packets 557 bytes 50077 (50.0 KB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 486 bytes 45965 (45.9 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 wlp3s0: flags=4163 mtu 1500 inet 192.168.0.43 netmask 255.255.255.0 broadcast 192.168.0.255 ether d8:fc:93:c5:df:aa txqueuelen 1000 (Ethernet) RX packets 6318 bytes 5376431 (5.3 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 4444 bytes 851545 (851.5 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 
network: version: 2 renderer: networkd ethernets: enp2s0: dhcp4: no wifis: wlp3s0: dhcp4: no dhcp6: no addresses: [192.168.0.44/24] gateway4: 192.168.0.1 access-points: "leibnitz": password: "***********" bridges: br0: dhcp4: no addresses: [192.168.0.10/24] interfaces: [enp2s0,wlp3s0] parameters: stp: true forward-delay: 4 

The bridge part in the config file is mostly a copy paste from here and there without really understanding whats happening. What i understood is that this creates a bridge between interfaces, and since i have specified that the interfaces to be used are enp2s0 and wlp3s0. It creates a bridge between the 2 interfaces (Sorry if i’m wrong about this). The current status is that i can connect to the internet via my wireless interface but cannot ping the primary router (192.168.0.1) nor any other computers on the same subnet. Following is the output of brctl show:

bridge name bridge id STP enabled interfaces br0 8000.7e0df9b168ba yes enp2s0 docker0 8000.0242a6e959a4 no vethea1fda5 vethf80ef47 

When i connect a computer(configured with a static IP) to enp2s0, i dont get anything. I cant even ping the computer which is connected to enp2s0. Any advice or help regarding the same would be great.

Читайте также:  Linux apt update что это

Источник

Ethernet -> Wlan мост

Сделал оба интерфейса в down, добавляю
[root@bupyc-netbook Video]# brctl addif br0 wlan0
can’t add wlan0 to bridge br0: Operation not supported
Какое есть решение? И какие вообще есть способы сделать мост между 2 интерфейсами, чтобы работал внутренний dhcp в сети ethernet для тех кто в wifi.

Ну в общем-то способо только один, тот который ты используешь 🙂 Смотри в dmesg какие ошибки выдает. Ну и интерфейсы в даун я думаю не надо класть.

Мне при настройке MikrotikOS, который основан на линуксе приходилось загонять wlan в бридж и уже потом этот бридж загонять во второй бридж, уже с ethernet. Мб есть аналогия с обычным линуксом.

перед добавлением в бридж подними wlan0 в режиме точки доступа

а если обе точки wifi в мост?

/etc/rc.d/wicd stop brctl addbr br0 /etc/rc.d/hostapd start #создаем сетку на wlan0 ifconfig eth0 down #кладем wifi broadcom brctl addif br0 eth0 brctl addif br0 wlan0 ifconfig br0 up ifconfig eth0 up /etc/rc.d/wicd start wicd-curses . не соединяется в dmesg много такого

[code] [155180.681196] br0: port 1(eth0) entering forwarding state [155180.681217] br0: port 1(eth0) entering forwarding state [155180.724730] sky2 0000:09:00.0: eth1: disabling interface [155185.383668] ADDRCONF(NETDEV_UP): eth1: link is not ready [155195.961172] eth0: no IPv6 routers present [155222.652414] sky2 0000:09:00.0: eth1: disabling interface [155222.676871] sky2 0000:09:00.0: eth1: enabling interface [155234.097218] ADDRCONF(NETDEV_UP): eth1: link is not ready [155235.219397] sky2 0000:09:00.0: eth1: disabling interface [155235.243406] sky2 0000:09:00.0: eth1: enabling interface [155235.245469] ADDRCONF(NETDEV_UP): eth1: link is not ready [155235.832657] sky2 0000:09:00.0: eth1: disabling interface [155235.852986] sky2 0000:09:00.0: eth1: enabling interface [155235.854649] ADDRCONF(NETDEV_UP): eth1: link is not ready [155242.922413] sky2 0000:09:00.0: eth1: disabling interface [155242.949875] sky2 0000:09:00.0: eth1: enabling interface [155242.952121] ADDRCONF(NETDEV_UP): eth1: link is not ready [155254.001174] eth0: no IPv6 routers present [155275.866005] sky2 0000:09:00.0: eth1: disabling interface [155275.886629] sky2 0000:09:00.0: eth1: enabling interface [155275.889025] ADDRCONF(NETDEV_UP): eth1: link is not ready [155286.161179] eth0: no IPv6 routers present [155304.898186] sky2 0000:09:00.0: eth1: disabling interface [155304.935206] sky2 0000:09:00.0: eth1: enabling interface [155304.936256] ADDRCONF(NETDEV_UP): eth1: link is not ready [155312.347830] wlan0: no IPv6 routers present [155315.574504] eth0: no IPv6 routers present [155331.003791] device wlan0 left promiscuous mode [155331.003816] br0: port 2(wlan0) entering disabled state [155331.003965] device eth0 left promiscuous mode [155331.004025] br0: port 1(eth0) entering disabled state [155333.593585] sky2 0000:09:00.0: eth1: disabling interface [155333.608225] sky2 0000:09:00.0: eth1: enabling interface [155333.609156] ADDRCONF(NETDEV_UP): eth1: link is not ready [/code]

Читайте также:  Linux where to mount

переводить интерфейсы в down не обязательно. Драйвер Wi-Fi карточки какой? может он это не умеет?

Источник

Мост между wifi и ethernet

Это работает, только если компьютер является точкой доступа, или если используется нестандартный 4-адресный режим wi-fi. Причина: конфликт на уровне протокола 802.11.

В обычном Ethernet’е различие mac-адреса официального получателя пакета и mac-адреса сетевой карты, которая его получает по факту (т.е. порта моста), проблемой не является. В wi-fi прием или отправка «чужих» пакетов невозможен, т.к. в заголовке есть место только для трех адресов из четырех (bssid, клиент, отправитель, получатель).

Подписался. Тоже хочу wifi в мост, только не с ethernet, а с tap, но это не важно наверное. Пробовал делать 4addr on, wifi просто отваливалась. Наверное на стороне точки тоже что-то сделать нужно.

Lavos ★★★★★ ( 02.11.16 13:48:36 MSK )
Последнее исправление: Lavos 02.11.16 13:49:01 MSK (всего исправлений: 1)

Да, на точке тоже надо включить четырехадресный режим.

Альтернативное решение — не делать честный мост, а настроить proxyarp. Копать в сторону parprouted.

У мну openwrt, оно наверное умеет. Но у меня ещё есть телефон с android вместо os, он сможет в 4addr?

с android вместо os, он сможет в 4addr?

Источник

Can I use Wi-Fi and cable (Ethernet) networking at same time?

I am on an intranet that is not connected to the Internet and a Wi-Fi router with connection to the Internet. When I am connected to the wireless network, I can browse the Internet, but I cannot browse my LAN with my Ethernet cable connected. How can I browse the Internet via my Wi-Fi router and at the same time browse my local LAN web application via my connected Ethernet cable?

How do you access «LAN applications»? Could you give us an example of the web address you are using to access them? Could you confirm that when you say «it tries to connect to the internet» you mean that when you try to access a LAN application it somehow tries to look for this application on the internet? How did you configure the network on your computer (both wireless and ethernet)?

Читайте также:  Чем отличаются друг от друга linux дистрибутивы

@Huygens I use the following address for my LAN web based apps: xxx.xxx.com/weberp. or 10.10.100.3/weberp. And it tries to go to the internet. Both connections are DHCP.

What is nslookup xxx.xxx.com returning for IP on the Wireless and what is it returning on the ethernet LAN? In addition, what is the subnet of your DHCP Wireless LAN and what is the sunet of your DHCP ethernet LAN? Finally, what is the routing table when you are connected to the ethernet LAN ( route -n )?

For what i understand, the wireless and wired are 2 different connections, there should be no problem for your system to resolve local names through your lan interface. Can you provide us some info on your ip addresses / subnet mask? Run the following command on your console and give us the results: ifconfig or ip add Post the results.

3 Answers 3

You sure can. You didn’t specify it, but I’m assuming you get the IP address automatically (via DHCP) both on wireless and wired connection.

Wired Ethernet is faster than wireless, so if there are two ways to get somewhere, wired will takes precedence over Wi-Fi by default. With that said, when you connect to both links, both DHCP servers by default will advertise themselves as the default gateway for all of the traffic.

So now your computer thinks it has two ways to connect to the Internet, and since wired is preferred it’ll send traffic for the Internet via Ethernet. If that’s the case, you would see two gateways for default networks 0.0.0.0 in your routing table, route -n , one with your wireless router as a gateway and one for the wired.

But the Metric for the Ethernet gateway would be lower than wireless, so your PC will send the packets there. Now that your Ethernet router gets them, it doesn’t know what to do with them, so it just drops them. The order where you connected first shouldn’t matter.

As far as fixing (this assumes the DHCP case), the correct way would be to tell the LAN router to stop advertising itself as the default gateway. You need to log in to the router and look through settings. If you have no control over the router, you can remove it from your end with:

route del default gw eth.router.ip.address 

Источник

Оцените статью
Adblock
detector