Open : AP-STA between 2 RPIs
Step 1: STA : Stop ongoing wireless activities |
Step 1: AP : Stop ongoing wireless activities |
Warning Internet is cut-off after this ! |
Warning Internet is cut-off after this ! |
$ service wpad stop
$ service network stop
$ service odhcpd stop
$ killall wpa_supplicant
$ killall wpa_cli
$ killall hostapd
$ killall hostapd_cli
$ killall dhclient
$ killall udhcpc
$ ifconfig wlan0 down
$ ifconfig wlan0 up
|
$ service wpad stop
$ service network stop
$ service odhcpd stop
$ killall wpa_supplicant
$ killall wpa_cli
$ killall hostapd
$ killall hostapd_cli
$ killall dhclient
$ killall udhcpc
$ ifconfig wlan0 down
$ ifconfig wlan0 up
|
Step 2: STA : Wireless interface status before connection |
Step 2: AP : Wireless interface status before connection |
Note wlan0 is the name of wireless interface on this RPI |
Note wlan0 is the name of wireless interface on this RPI |
$ iwconfig wlan0
wlan0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
|
$ iwconfig wlan0
wlan0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
|
Step 3: STA : ifconfig interface status before connection |
Step 3: AP : ifconfig interface status before connection |
$ ifconfig wlan0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 02:00:00:00:00:00 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
|
$ ifconfig wlan0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether 02:00:00:00:00:00 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
|
Step 4: STA : Bring down and Bring up wlan0 interface |
Step 4: AP : Bring down and Bring up wlan0 interface |
$ ifconfig wlan0 down
$ ifconfig wlan0 up
|
$ ifconfig wlan0 down
$ ifconfig wlan0 up
|
Step 5: STA : Create run_supplicant.conf |
Step 5: AP : Create run_hostapd.conf |
Note ssid in /tmp/run_supplicant.conf should match ssid in /tmp/run_hostapd.conf |
Note ssid in /tmp/run_hostapd.conf should be used by clients while connecting to AP |
$ vim /tmp/run_supplicant.conf
ctrl_interface=/tmp/wpa_supplicant
network={
ssid="test_open"
key_mgmt=NONE
}
|
$ vim /tmp/run_hostapd.conf
ctrl_interface=/tmp/hostapd
interface=wlan0
driver=nl80211
ssid=test_open
hw_mode=a
channel=36
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
|
Step 6: STA : Run wpa_supplicant |
Step 6: AP : Run hostapd |
Note CTRL-EVENT-CONNECTED indicates successful connection to AP |
Note AP-STA-CONNECTED indicates successful connection of STA |
$ /usr/sbin/wpa_supplicant -Dnl80211 -i wlan0 -c /tmp/run_supplicant.conf &
Successfully initialized wpa_supplicant
wlan0: SME: Trying to authenticate with 02:00:00:00:00:00 (SSID='test_open' freq=2437 MHz)
wlan0: Trying to associate with 02:00:00:00:00:00 (SSID='test_open' freq=2437 MHz)
wlan0: Associated with 02:00:00:00:00:00
wlan0: CTRL-EVENT-CONNECTED - Connection to 02:00:00:00:00:00 completed [id=0 id_str=]
wlan0: CTRL-EVENT-SUBNET-STATUS-UPDATE status=0
|
$ /usr/sbin/hostapd /tmp/run_hostapd.conf &
wlan0: interface state UNINITIALIZED->ENABLED
wlan0: AP-ENABLED
wlan0: STA 02:00:00:00:01:00 IEEE 802.11: authenticated
wlan0: STA 02:00:00:00:01:00 IEEE 802.11: associated (aid 1)
wlan0: AP-STA-CONNECTED 02:00:00:00:01:00
wlan0: STA 02:00:00:00:01:00 RADIUS: starting accounting session C449579BCDA93EF3
|
Step 7: STA : Check ps status and confirm wpa_supplicant process is running |
Step 7: AP : Check ps status and confirm hostapd process is running |
$ ps | grep -i wpa
3852 root 4372 S /usr/sbin/wpa_supplicant -Dnl80211 -i wlan0 -c /tmp/run_supplicant
|
$ ps | grep -i hostapd
2144 root 4380 S /usr/sbin/hostapd /tmp/run_hostapd.conf
|
Step 8: STA : Check connection status using wpa_cli |
Step 8: AP : Check connection status using hostapd_cli |
Note wpa_state=COMPLETED indicates successful connection. Check output of status |
Note aid=1 is assigned to connected station. Check output of all_sta |
$ /usr/sbin/wpa_cli -i wlan0 -p /tmp/wpa_supplicant
> status
bssid=02:00:00:00:00:00
freq=2437
ssid=test_open
id=1
mode=station
pairwise_cipher=NONE
group_cipher=NONE
key_mgmt=NONE
wpa_state=COMPLETED
address=02:00:00:00:01:00
uuid=e22ecb71-2706-5c5b-9521-e1cd7dbf8e11
|
$ /usr/sbin/hostapd_cli -i wlan0 -p /tmp/hostapd
hostapd_cli v2.9
Copyright (c) 2004-2019, Jouni Malinen <j@w1.fi> and contributors
This software may be distributed under the terms of the BSD license.
See README for more details.
Interactive mode
> status
state=ENABLED
phy=phy1
freq=2437
num_sta_non_erp=0
num_sta_no_short_slot_time=0
num_sta_no_short_preamble=0
olbc=0
num_sta_ht_no_gf=0
num_sta_no_ht=0
num_sta_ht_20_mhz=0
num_sta_ht40_intolerant=0
olbc_ht=0
ht_op_mode=0x0
cac_time_seconds=0
cac_time_left_seconds=N/A
channel=6
secondary_channel=0
ieee80211n=0
ieee80211ac=0
ieee80211ax=0
beacon_int=100
dtim_period=2
supported_rates=02 04 0b 16 0c 12 18 24 30 48 60 6c
max_txpower=20
bss[0]=wlan0
bssid[0]=02:00:00:00:00:00
ssid[0]=test_open
num_sta[0]=1
>
>
> all_sta
02:00:00:00:01:00
flags=[AUTH][ASSOC][AUTHORIZED][SHORT_PREAMBLE]
aid=1
capability=0x421
listen_interval=5
supported_rates=02 04 0b 16 0c 12 18 24 30 48 60 6c
timeout_next=NULLFUNC POLL
rx_packets=8
tx_packets=4
rx_bytes=550
tx_bytes=252
inactive_msec=12976
signal=-30
rx_rate_info=20
tx_rate_info=10
connected_time=75
supp_op_classes=5151525354737475767778797a7b7c7d7e7f808182
ext_capab=0400400001000040
|
Step 9: STA : Wireless interface status after connection |
Step 9: AP : Wireless interface status after connection |
Note ESSID field in iwconfig should show ssid of AccessPoint |
Note Mode field in iwconfig should show master |
$ iwconfig
wlan0 IEEE 802.11 ESSID:"test_open"
Mode:Managed Frequency:2.437 GHz Access Point: 02:00:00:00:00:00
Bit Rate:54 Mb/s Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=70/70 Signal level=-30 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
$ iw dev
phy#2
Interface wlan0
ifindex 6
wdev 0x200000001
addr 02:00:00:00:01:00
ssid test_open
type managed
channel 6 (2437 MHz), width: 20 MHz (no HT), center1: 2437 MHz
txpower 20.00 dBm
|
$ iwconfig
wlan0 IEEE 802.11 ESSID:"test_open"
Mode:Managed Frequency:2.437 GHz Access Point: 02:00:00:00:00:00
Bit Rate:54 Mb/s Tx-Power=20 dBm
Retry short limit:7 RTS thr:off Fragment thr:off
Power Management:on
Link Quality=70/70 Signal level=-30 dBm
Rx invalid nwid:0 Rx invalid crypt:0 Rx invalid frag:0
Tx excessive retries:0 Invalid misc:0 Missed beacon:0
$ iw dev
phy#2
Interface wlan0
ifindex 6
wdev 0x200000001
addr 02:00:00:00:01:00
ssid test_open
type managed
channel 6 (2437 MHz), width: 20 MHz (no HT), center1: 2437 MHz
txpower 20.00 dBm
|
Step 10: STA : Assign Static IP address 192.168.3.10 to wlan0 |
Step 10: AP : Assign Static IP address 192.168.3.1 to wlan0 |
Note Station and AP should be in same IP subnet. Assign 192.168.3.10 to Station |
Note Station and AP should be in same IP subnet. Assign 192.168.3.1 to AP |
Attention Use static IP assignment if DHCP server is not supported by AP |
Attention Use static IP assignment if DHCP server is not supported by AP |
$ ifconfig wlan0 192.168.3.10 up
$ ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.10 netmask 255.255.255.0 broadcast 192.168.3.255
ether 02:00:00:00:01:00 txqueuelen 1000 (Ethernet)
RX packets 73 bytes 13119 (13.1 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 65 bytes 13111 (13.1 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
$ ifconfig wlan0 192.168.3.1 up
$ ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.3.1 netmask 255.255.255.0 broadcast 192.168.3.255
ether 02:00:00:00:00:00 txqueuelen 1000 (Ethernet)
RX packets 61 bytes 11085 (11.0 KB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 130 bytes 25688 (25.6 KB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
|
Step 11: STA : Assign DHCP IP address |
Step 11: AP : Assign DHCP IP address |
Attention This initiates DORA. Make sure DHCP server is running in AP ! |
Attention odhcpd and dnsmasq needs to be installed to setup DHCP server |
Note udhcpc is DHCP client |
Note See below ! Add configuration in /etc/dhcp/dhcpd.conf |
Note udhcpc -i wlan0 gets IP address from DHCP server |
Note See below ! Add configuration in /etc/default/odhcpd and dnsmasq |
# Release any existing IP address
$ ifconfig wlan0 0.0.0.0 up
# Run DHCP client on wlan0. This initiates DORA
$ udhcpc -i wlan0
# Check if wlan0 got IP address
$ ifconfig wlan0
|
|
Step 12: STA : Ping AP —-> Ap is 192.168.3.1 |
Step 12: AP : Ping STA —-> STA is 192.168.3.10 |
Note 192.168.3.1 is IP address of Access Point |
Note 192.168.3.10 is IP address of Station |
$ ping 192.168.3.1
PING 192.168.3.1 (192.168.3.1) 56(84) bytes of data.
64 bytes from 192.168.3.1: icmp_seq=1 ttl=64 time=0.121 ms
64 bytes from 192.168.3.1: icmp_seq=2 ttl=64 time=0.091 ms
64 bytes from 192.168.3.1: icmp_seq=3 ttl=64 time=0.090 ms
64 bytes from 192.168.3.1: icmp_seq=4 ttl=64 time=0.097 ms
64 bytes from 192.168.3.1: icmp_seq=5 ttl=64 time=0.243 ms
|
$ ping 192.168.3.10
PING 192.168.3.10 (192.168.3.10) 56(84) bytes of data.
64 bytes from 192.168.3.10: icmp_seq=1 ttl=64 time=0.092 ms
64 bytes from 192.168.3.10: icmp_seq=2 ttl=64 time=0.036 ms
64 bytes from 192.168.3.10: icmp_seq=3 ttl=64 time=0.094 ms
64 bytes from 192.168.3.10: icmp_seq=4 ttl=64 time=0.105 ms
64 bytes from 192.168.3.10: icmp_seq=5 ttl=64 time=0.094 ms
|
Step 13: STA : Run TCP server for TCP Downlink test |
Step 13: AP : Run TCP Client for TCP Downlink test |
$ iperf -s -i 1
|
$ iperf -c 192.168.3.10 -i 1 -t 30
|
Step 14: STA : Run TCP client for TCP Uplink test |
Step 14: AP : Run TCP Server for TCP Uplink test |
$ iperf -c 192.168.3.1 -i 1 -t 30
|
$ iperf -s -i 1
|
Step 15: STA : Run UDP server for UDP Downlink test |
Step 15: AP : Run UDP Client for UDP Downlink test |
$ iperf -s -u -i 1
|
$ iperf -c 192.168.3.10 -u -b 1000M -i 1 -t 30
|
Step 16: STA : Run UDP client for UDP Uplink test |
Step 16: AP : Run UDP Server for UDP Uplink test |
$ iperf -c 192.168.3.1 -u -b 1000M -i 1 -t 30
|
$ iperf -s -u -i 1
|