Meu objetivo é simples. Eu quero compartilhar internet disponível na ethernet eth0 para wlan0 que está agindo como um ponto de acesso. Mas eu já fiz uma bridge br-lan entre eth0 e tap0. Então eu não sou capaz de bridge br0 com eth0 e wlan0. Aqui é meu
/ etc / network / interfaces
source-directory /etc/network/interfaces.d
auto lo
iface lo inet loopback
allow-hotplug eth0
iface eth0 inet manual
address 0.0.0.0
allow-hotplug wlan0
iface wlan0 inet manual
address 0.0.0.0
auto br-lan
iface br-lan inet dhcp
bridge-ports eth0
auto br0
iface br0 inet static
address 192.168.2.1
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
bridge_ports eth0 wlan0
bridge_fd 1
bridge_hello 1
bridge_stp on
ifconfig
br0 Link encap:Ethernet HWaddr 00:17:7c:22:88:18
inet addr:192.168.2.1 Bcast:192.168.2.255 Mask:255.255.255.0
inet6 addr: fe80::217:7cff:fe22:8818/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:30 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:4901 (4.9 KB)
br-lan Link encap:Ethernet HWaddr 00:04:9f:04:10:39
inet addr:192.168.1.125 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fd00:aaaa::204:9fff:fe04:1039/64 Scope:Global
inet6 addr: fd45:6807:17db:0:204:9fff:fe04:1039/64 Scope:Global
inet6 addr: fd00:aaaa::85c:ae5a:130d:40f/64 Scope:Global
inet6 addr: fe80::204:9fff:fe04:1039/64 Scope:Link
inet6 addr: fd45:6807:17db:0:85c:ae5a:130d:40f/64 Scope:Global
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1039 errors:0 dropped:0 overruns:0 frame:0
TX packets:161 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:393281 (393.2 KB) TX bytes:23516 (23.5 KB)
eth0 Link encap:Ethernet HWaddr 00:04:9f:04:10:39
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:1177 errors:0 dropped:1 overruns:0 frame:0
TX packets:214 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:478095 (478.0 KB) TX bytes:32178 (32.1 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:86 errors:0 dropped:0 overruns:0 frame:0
TX packets:86 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:6483 (6.4 KB) TX bytes:6483 (6.4 KB)
tap0 Link encap:Ethernet HWaddr 7e:e0:12:05:00:39
inet6 addr: fe80::7ce0:12ff:fe05:39/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:28 errors:0 dropped:0 overruns:0 frame:0
TX packets:728 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:500
RX bytes:4385 (4.3 KB) TX bytes:282726 (282.7 KB)
wlan0 Link encap:Ethernet HWaddr 00:17:7c:22:88:18
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:43 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:3724 (3.7 KB)
/etc/hostapd/hostapd.conf
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
# 802.11n related stuff
ieee80211n=1
noscan=1
ht_capab=[HT40+][SHORT-GI-20][SHORT-GI-40]
#WPA2 settings
wpa=2
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP
# Most modern wireless drivers in the kernel need driver=nl80211
#driver=nl80211
driver=rtl871xdrv
max_num_sta=8
beacon_int=100
wme_enabled=1
wpa_group_rekey=86400
device_name=RTL8192CU
manufacturer=Realtek
# set proper interface
interface=wlan0
bridge=br0
hw_mode=g
# best channels are 1 6 11 14 (scan networks first to find which slot is free)
channel=6
# this is the network name
ssid=***
wpa_passphrase=***
/etc/dnsmasq.d/dhcp.conf
dhcp-range=192.168.2.100,192.168.2.200,255.255.255.0,12h
dhcp-option=option:router,192.168.2.1
dhcp-option=option:dns-server,192.168.2.1
dhcp-authoritative
rota
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
default 192.168.1.1 0.0.0.0 UG 0 0 0 br-lan
192.168.1.0 * 255.255.255.0 U 0 0 0 br-lan
192.168.2.0 * 255.255.255.0 U 0 0 0 br0
mostra brctl
bridge name bridge id STP enabled interfaces
br-lan 8000.00049f041039 no eth0
tap0
br0 8000.00177c228818 yes wlan0
rota ip
default via 192.168.1.1 dev br-lan
192.168.1.0/24 dev br-lan proto kernel scope link src 192.168.1.125
192.168.2.0/24 dev br0 proto kernel scope link src 192.168.2.1
Então, eu posso acessar a internet a partir da máquina linux e hospedar um AP através de br0 (wlan0) e obter meu celular conectado a ele e obter IP e pingar 192.168.2.1 do meu celular.
Como eu vejo, a eth0 não pode ser preenchida com br0, já que ela já é preenchida com br-lan. Então, como posso dar internet para br0 ou wlan0 (o wi-fi)?
Eu posso fazer ping nas duas redes.
ping 192.168.1.1
PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_seq=1 ttl=64 time=0.856 ms
64 bytes from 192.168.1.1: icmp_seq=2 ttl=64 time=0.816 ms
ping 192.168.2.149
PING 192.168.2.149 (192.168.2.149) 56(84) bytes of data.
64 bytes from 192.168.2.149: icmp_seq=1 ttl=64 time=5.46 ms
64 bytes from 192.168.2.149: icmp_seq=2 ttl=64 time=4.58 ms