1

Background: I am trying to set up an access point on Linux. The ultimate aim is to run SSLStrip (for an exercise) so I need to be able to do something like this, to redirect port 80 traffic through port 10000, on which SSLStrip listens.

iptables -t nat -A PREROUTING -p tcp --destination-port 80 -j REDIRECT --to-port 10000

Using Linux - Kali2, 64bit. Machine has internet access via eth0.


This is how I am setting up the access point:

airmon-ng start wlan0 6
modprobe tun

ifconfig wlan0mon down
iwconfig wlan0mon mode monitor
ifconfig wlan0mon up

airbase-ng -e "MyAccessPoint" -c 6 wlan0mon &

ifconfig "at0" up
ifconfig "at0" "10.0.0.1" netmask "255.255.255.0"
ifconfig "at0" mtu 1500
route add -net "10.0.0.0" netmask "255.255.255.0" gw "10.0.0.1" dev "at0"

Into /etc/dhcp/dhcpd.conf I put the following:

subnet 10.0.0.0 netmask 255.255.255.0 {
    authoritative;
    range 10.0.0.100 10.0.0.200;
    default-lease-time 3600;
    max-lease-time 7200;
    option subnet-mask 255.255.255.0;
    option broadcast-address 10.0.0.255;
    option routers 10.0.0.1;
    option domain-name-servers 8.8.8.8;
    option domain-name “freeinternet.co.uk” 
}

Check that /etc/default/isc-dhcp-server has INTERFACES=”at0”

Start the DHCP Server:

/etc/init.d/isc-dhcp-server restart

Configure NAT and enable ip forwarding:

iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain
iptables -P FORWARD ACCEPT
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
echo "1" > /proc/sys/net/ipv4/ip_forward

At this stage I believe I should be able to connect a client to my access point and browse the web.

The client sees the access point, connects, gets an IP address from the server's DHCP (10.0.0.101) and then has the following routing table:

mark@laptop15:~/TT$ route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.0.0.1        0.0.0.0         UG    0      0        0 wlan0
10.0.0.0        0.0.0.0         255.255.255.0   U     9      0        0 wlan0

However it cannot even ping the server (10.0.0.1) - no errors, we just don't get the pings back:

mark@laptop15:~/TT$ ping 10.0.0.1
PING 10.0.0.1 (10.0.0.1) 56(84) bytes of data.

And it stays like that forever.

What am I doing wrong please?

migrated from serverfault.com Dec 2 '15 at 11:42

This question came from our site for system and network administrators.

1

Turns out it was network-manager interfering. Switched it off

service network-manager stop

and everything works fine.

I suspect there exists a less drastic solution than disabling it altogether, but it does what I need for now.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.