Eu tenho duas interfaces de rede wlan0
e usb0
em um RaspberryPi executando o Ubuntu. Todos eles estão conectados à Internet.
Estou escrevendo um script python para executar um servidor web no wlan0
. Quando uma solicitação é enviada para meu pi, enviarei outra solicitação para usb0
, os dados da resposta serão enviados de volta para o local de origem da solicitação.
Quando tento enviar uma solicitação de teste por meio do wlan0
, ele funciona conforme o esperado. Mas quando tento usar usb0
em vez disso, não funciona
ifconfig
resultado:
eth0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether dc:a6:32:46:16:87 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
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 (Local Loopback)
RX packets 120 bytes 9012 (9.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 120 bytes 9012 (9.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.42.208 netmask 255.255.255.0 broadcast 192.168.42.255
inet6 fe80::54e4:31ff:fe59:90d9 prefixlen 64 scopeid 0x20<link>
ether 56:e4:31:59:90:d9 txqueuelen 1000 (Ethernet)
RX packets 8 bytes 1428 (1.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 12 bytes 2008 (2.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.195 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::dea6:32ff:fe46:1688 prefixlen 64 scopeid 0x20<link>
inet6 2402:800:6116:a8ae:dea6:32ff:fe46:1688 prefixlen 64 scopeid 0x0<global>
ether dc:a6:32:46:16:88 txqueuelen 1000 (Ethernet)
RX packets 464 bytes 57446 (57.4 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 394 bytes 65085 (65.0 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
Tabela de roteamento:
default via 192.168.1.1 dev wlan0
default via 192.168.1.1 dev wlan0 proto dhcp src 192.168.1.195 metric 600
192.168.1.0/24 dev wlan0 proto kernel scope link src 192.168.1.195
192.168.1.1 dev wlan0 proto dhcp scope link src 192.168.1.195 metric 600
192.168.42.0/24 dev usb0 proto kernel scope link src 192.168.42.208
broadcast 127.0.0.0 dev lo table local proto kernel scope link src 127.0.0.1
local 127.0.0.0/8 dev lo table local proto kernel scope host src 127.0.0.1
local 127.0.0.1 dev lo table local proto kernel scope host src 127.0.0.1
broadcast 127.255.255.255 dev lo table local proto kernel scope link src 127.0.0.1
broadcast 192.168.1.0 dev wlan0 table local proto kernel scope link src 192.168.1.195
local 192.168.1.195 dev wlan0 table local proto kernel scope host src 192.168.1.195
broadcast 192.168.1.255 dev wlan0 table local proto kernel scope link src 192.168.1.195
broadcast 192.168.42.0 dev usb0 table local proto kernel scope link src 192.168.42.208
local 192.168.42.208 dev usb0 table local proto kernel scope host src 192.168.42.208
broadcast 192.168.42.255 dev usb0 table local proto kernel scope link src 192.168.42.208
::1 dev lo proto kernel metric 256 pref medium
2402:800:6116:a8ae::/64 dev wlan0 proto ra metric 600 expires 86355sec pref medium
fe80::/64 dev wlan0 proto kernel metric 256 pref medium
fe80::/64 dev usb0 proto kernel metric 256 pref medium
default via fe80::1 dev wlan0 proto ra metric 600 expires 1755sec pref low
local ::1 dev lo table local proto kernel metric 0 pref medium
local 2402:800:6116:a8ae:dea6:32ff:fe46:1688 dev wlan0 table local proto kernel metric 0 pref medium
local fe80::54e4:31ff:fe59:90d9 dev usb0 table local proto kernel metric 0 pref medium
local fe80::dea6:32ff:fe46:1688 dev wlan0 table local proto kernel metric 0 pref medium
ff00::/8 dev wlan0 table local metric 256 pref medium
ff00::/8 dev usb0 table local metric 256 pref medium
Desculpe se estou fazendo uma pergunta estúpida, sou completamente noob nessas coisas de networking...