Sample Header Ad - 728x90

How to access IP and port configuration of the tablet running Linuxmint with "hostapd + DHCP"

0 votes
0 answers
27 views
_My task_: Configure and run Access Point (AP) on the tablet (x86) with Linux mint with access from devices connected to the created AP. ##### Background as additional information (but this is not the topic of question, *real question at the end of description*): - Some measurement devices must connect to this tablet via AP and send data to it throw tcp socket. #### I have done the next parts: --- ## 1. Created the Virtual WiFi interface - the created intefce works as isolated (not bridged, like a router) All the scripts are provided for the physical WiFi interface wlp1s0 I created the virtual interface with the name wlp1s0_ap - Created a unit (service) file as /lib/systemd/system/wireless-device@.service
[Unit]
Description=Create virtual wireless interface
Requires=sys-subsystem-net-devices-wlp1s0.device
#After=network.target
After=sys-subsystem-net-devices-wlp1s0.device
[Service]
Type=oneshot
#ExecStart=/usr/sbin/iw dev wlp1s0 interface add %I type __ap  addr "00:0c:e3:6f:78:ee"
ExecStart=/usr/sbin/iw dev wlp1s0 interface add %I type managed addr "00:0c:e3:6f:78:ee"
#ExecStart=/usr/bin/iw dev wlan0 interface add wlp1s0_ap type __ap addr "00:0c:e3:6f:78:ee"
[Install]
WantedBy=multi-user.target
- Then run systemctl enable wireless-device@wlp1s0_ap.service - Reboot the PC --- ## 2. Added the new virtual interface into ignored ones for the **NetworkManager** **edit:**
sudo nano /etc/NetworkManager/NetworkManager.conf
by adding **wlp1s0_ap** created interface into _unmanaged-devices_ section (**NB!** append to existing ones)
[keyfile]
unmanaged-devices=interface-name:wlp1s0_ap
run
sudo nmcli general reload
--- ## 3. Configured hostapd I called the AP as EVT with password ******. More details are below. - install hostapd - sudo apt install hostapd - edit the file sudo nano /etc/default/hostapd - current version is below
DAEMON_CONF="/etc/hostapd/hostapd.conf"
- edit the configuration file (below is the current variant): - sudo nano /etc/hostapd/hostapd.conf
interface=wlp1s0_ap
driver=nl80211
country_code=EE

ssid=EVT
wpa_passphrase=****

hw_mode=g
channel=10

wpa=2
wpa_key_mgmt=WPA-PSK

wpa_pairwise=TKIP
rsn_pairwise=CCMP
auth_algs=1
macaddr_acl=0
ieee80211n=1
- the daemon is started as - sudo systemctl start hostapd --- ## 4. Configured DHCP server Fro the DHCP server isc-dhcp-server is selected. ### _isc-dhcp-server_ configuration - install: sudo apt install isc-dhcp-server - edit the file - sudo nano /etc/dhcp/dhcpd.conf, (below is the current variant):
# dhcpd.conf

#INTERFACES="wlp1s0_ap"

option domain-name "etv.org";
option domain-name-servers 192.168.1.2, 192.168.1.3;

default-lease-time 86400;
max-lease-time 604800;

ddns-update-style none;

authoritative;

subnet 192.168.1.0 netmask 255.255.255.0 {
        interface wlp1s0_ap;
        ## dhcp start  and end IP range ##
        range 192.168.1.100 192.168.1.200;
        option subnet-mask 255.255.255.0;     ## subnet
        option broadcast-address 192.168.1.255; ## broadcast
        option routers 192.168.1.254; ## router IP
}
The daemon is started as service isc-dhcp-server start --- ## 5. Assigned static IP address for the created virtual interface I modified the file to assign the IP 192.168.1.111 to the interface wlp1s0_ap:
sudo nano /etc/network/interfaces
the content of the /etc/network/interfaces file is
auto lo
iface lo inet loopback

auto wlp1s0_ap
iface wlp1s0_ap inet static
  address 192.168.1.111
  netmask 255.255.255.0
  gateway 192.168.1.0
  broadcast 192.168.1.255
  dns-nameservers 192.168.1.2,192.168.1.3
--- ### The parts described above are working and I can connect to the AP. ### ifconfig listing:
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 1386  bytes 149889 (149.8 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 1386  bytes 149889 (149.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp1s0: flags=4163  mtu 1500
        inet 172.20.92.22  netmask 255.255.255.0  broadcast 172.20.92.255
        inet6 fe80::9ea9:58d3:aa31:b7e9  prefixlen 64  scopeid 0x20
        ether 00:0c:e3:6f:78:ed  txqueuelen 1000  (Ethernet)
        RX packets 1111808  bytes 125498550 (125.4 MB)
        RX errors 0  dropped 7507  overruns 0  frame 0
        TX packets 23673  bytes 3070974 (3.0 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlp1s0_ap: flags=4163  mtu 1500
        inet 192.168.1.111  netmask 255.255.255.0  broadcast 192.168.1.255
        inet6 fe80::20c:e3ff:fe6f:78ee  prefixlen 64  scopeid 0x20
        ether 00:0c:e3:6f:78:ee  txqueuelen 1000  (Ethernet)
        RX packets 808  bytes 124999 (124.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 893  bytes 155057 (155.0 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
# Problem: **However I cannot communicate with this Tablet** For example, ping to the assigned IP ping 192.168.1.111 gives the next response:
PING 192.168.1.111 (192.168.1.111) 56(84) bytes of data.
From 192.168.1.101 icmp_seq=1 Destination Host Unreachable
From 192.168.1.101 icmp_seq=2 Destination Host Unreachable
From 192.168.1.101 icmp_seq=3 Destination Host Unreachable
From 192.168.1.101 icmp_seq=4 Destination Host Unreachable
^C
--- 192.168.1.111 ping statistics ---
5 packets transmitted, 0 received, +4 errors, 100% packet loss, time 4065ms
**telnet** output:
~$ telnet 192.168.1.111
Trying 192.168.1.111...
telnet: Unable to connect to remote host: No route to host
The questions: 1. What I missed? 2. How to configure the access to the Tablet on which hostapd + DHCP are running?
Asked by Andrei Krivoshei (101 rep)
Oct 28, 2024, 02:57 PM