You are not logged in.

#1 2020-11-18 00:19:29

scottsteely
Member
Registered: 2020-11-17
Posts: 2

Setting up a NAT access point using hostapd

Hello all,
I am trying to setup a NAT access point with IP Masquerade because I am connected to public internet. I have attempted to follow the instructions listed here: https://wiki.archlinux.org/index.php/Internet_sharing and https://wiki.archlinux.org/index.php/so … cess_point .

My wifi card supports Wireless client and software AP with a single Wi-Fi device:

iw list : valid interface combinations: * #{ managed } <= 1, #{ AP, P2P-client, P2P-GO } <= 1, #{ P2P-device } <= 1, total <= 3, #channels <= 2

The next instructions say that:

you need to create two separate virtual interfaces for using it. Virtual interfaces for a physical device wlan0

I am able to create both wlan0_sta and wlan0_ap but I am unclear what the purpose of wlan0_sta is.

This is my hostapd.conf which I can connect to only if I comment out bridge=br0 . (do I need this if I'm setting up a NAT?)

interface=wlan0_ap
#bridge=br0
driver=nl80211
ssid=xxxxxxxx
hw_mode=g
channel=6
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=2
wpa_passphrase=xxxxxxxx
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP

# hostapd event logger configuration
logger_stdout=-1
logger_stdout_level=2

I am able to connect to this AP but I do not have internet.
I verified IP forwarding with

sysctl -a | grep forward

http://ix.io/2Ew3

I have enabled the IP Tables per the instructions.
http://ix.io/2Ew7

Here is my dhcpd.conf

option domain-name-servers 8.8.8.8, 8.8.4.4;
option subnet-mask 255.255.255.0;
#option routers 139.96.30.100;
subnet 192.168.123.0 netmask 255.255.255.0 {
  range 192.168.123.2 192.168.123.25;
}

Also here are my systemd.networkd rules:
25-wireless.network
30-wlan0_ap.network

I would really apretiate if anyone could look these over. I'm sure I've miss-configured something, I'm just not sure what. Thanks.

Offline

#2 2020-11-18 08:12:20

seth
Member
Registered: 2012-09-03
Posts: 50,983

Re: Setting up a NAT access point using hostapd

I am unclear what the purpose of wlan0_sta is

Outgoing connection.
You must connect that NIC to
3486822e9654f3542cb64519b7d82f1e.gif
(scnr)


Ie. it's the device where you must run eg. dhcpcd on (what would usually be wlan0)

Offline

#3 2020-11-18 14:03:03

Koatao
Member
Registered: 2018-08-30
Posts: 92

Re: Setting up a NAT access point using hostapd

Hello,

To add a bit more remarks:

scottsteely wrote:

I am trying to setup a NAT access point with IP Masquerade because I am connected to public internet.

This is my hostapd.conf which I can connect to only if I comment out bridge=br0 . (do I need this if I'm setting up a NAT?)

No you don't need to comment out bridge=br0 if you are setting up a NAT between wlan0_ap et wlan0_sta.

Also here are my systemd.networkd rules:
25-wireless.network
30-wlan0_ap.network

It is confusing!

You are setting up a DHCP server on wlan0_ap with Glass-ISC-DHCP (dhcp package) and another on wlan0 (wlan0_ap is what you really want, i think) with systemd-netowrkd (what seems to be a copy paste from the wiki). Choose one of the two.

Moreover, you don't need to specify DHCP=yes in you 30-wlan0_ap.network file because you are setting up IP address statically with

Address=192.168.123.100/24

https://wiki.archlinux.org/index.php/Systemd-networkd

Last edited by Koatao (2020-11-18 14:04:35)

Online

Board footer

Powered by FluxBB