두 번째 Wi-Fi 인터페이스를 연결한 후 인터넷에 연결되지 않음

두 번째 Wi-Fi 인터페이스를 연결한 후 인터넷에 연결되지 않음

Hostapd 및 dnsmasq를 사용하여 우분투 서버(16.04TLS)를 액세스 포인트로 설정했습니다. 인터넷 연결에는 내장 Wi-Fi 네트워크 카드(RTLINK)를 사용하고 액세스 포인트에는 Wi-Fi-USB 어댑터를 사용합니다. Wifi-Usb를 연결하지 않아도 안정적인 인터넷 연결이 가능합니다(curl을 사용하여 인터넷 서핑을 할 수 있습니다). USb-Stick(Edimax EW-7811Un)을 연결한 후 장치를 연결할 수 있지만(액세스 포인트를 브로드캐스트) 더 이상 인터넷에 연결되지 않습니다.

무엇이 문제가 될 수 있나요?

게이트웨이는 192.168.2.1입니다.

rc.local

iptables -t nat -A POSTROUTING -s 192.168.2.0/24 ! -d 192.168.2.0/24 -j MASQUERADE 

/etc/네트워크/인터페이스

    auto lo
iface lo inet loopback
auto wlx74da382e3878
iface wlx74da382e3878 inet static
hostapd /etc/hostapd/hostapd.conf
address 192.168.2.1
netmask 255.255.255.0

auto wlo1
allow-hotplug wlo1
iface wlo1 inet dhcp 
...wpa-settings 

$ifconfig (인터넷 연결을 위해 ADSL-Router 연결에 사용되는 wlo1)

 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:190 errors:0 dropped:0 overruns:0 frame:0
          TX packets:190 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:15885 (15.8 KB)  TX bytes:15885 (15.8 KB)

wlo1      Link encap:Ethernet  HWaddr bc:85:56:47:69:37
          inet addr:192.168.2.103  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::be85:56ff:fe47:6937/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6935 errors:0 dropped:0 overruns:0 frame:0
          TX packets:600 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2412406 (2.4 MB)  TX bytes:78228 (78.2 KB)

wlx74da382e3878 Link encap:Ethernet  HWaddr 74:da:38:2e:38:78
          inet addr:192.168.2.1  Bcast:192.168.2.255  Mask:255.255.255.0
          inet6 addr: fe80::76da:38ff:fe2e:3878/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:792 (792.0 B)

iwconfig(wlx74da382e3878(usb-wifi-adapter)가 액세스 포인트 역할을 함)

> wlo1      IEEE 802.11bgn  ESSID:"TP-LINK_D"
>           Mode:Managed  Frequency:2.417 GHz  Access Point: A0:F3:C1:D7:33:38
>           Bit Rate=1 Mb/s   Tx-Power=20 dBm
>           Retry short limit:7   RTS thr:off   Fragment thr:off
>           Encryption key:off
>           Power Management:off
>           Link Quality=70/70  Signal level=-39 dBm
>           Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
>           Tx excessive retries:0  Invalid misc:11   Missed beacon:0
> 
> wlx74da382e3878  IEEE 802.11bgn  Mode:Master  Tx-Power=20 dBm
>           Retry short limit:7   RTS thr:off   Fragment thr:off
>           Power Management:on

Hostapd.conf

interface=wlx74da382e3878
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=TEST-WLAN
hw_mode=g
channel=1
beacon_int=100
dtim_period=2
max_num_sta=255
rts_threshold=2347
fragm_threshold=2346
macaddr_acl=0
auth_algs=3
ignore_broadcast_ssid=0
eapol_key_index_workaround=0
eap_server=0
own_ip_addr=127.0.0.1
rsn_pairwise=CCMP
wmm_enabled=1

$ 경로 -n

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         192.168.2.1     0.0.0.0         UG    0      0        0 wlo1
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 wlo1
192.168.2.0     0.0.0.0         255.255.255.0   U     0      0        0 wlx74da382e3878

답변1

좋아, Ipor Sircer의 의견이 옳았습니다. 저는 설정(AP 연결 및 관리 연결)에서 동일한 IP 범위를 사용했습니다. 내 라우터에는 192.168.2.1 Gateway-IP가 있으므로 Hostapd-wifi-adapter에 대해 동일한 범위를 설정하겠습니다. 10.0.0.1에서 Hostapd의 주소를 설정한 후 문제가 해결되었습니다.

관련 정보