You are not logged in.

#151 2015-01-29 22:09:23

Cz-David
Member
Registered: 2012-05-25
Posts: 33

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

I've compared a ping packet before I apply the prerouting mangle and after. And they are functionally identical, nothing that is not subject to change actually changes before and after. But before I apply the rule I get ICMP TTL exceeded in transit and afterwards I don't. I can not figure it out, what kind of protection does the router above me use?

Offline

#152 2015-01-30 09:51:46

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

To change the TTL of the packets that you sent you must use '-i wlan0' in your case. Now, with '-i eth0' you actually change the TTL of the received packets. In other words, if you use ping in your client (the computer that is connected to AP) you will always see something like:

PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=63 time=78.3 ms

Probably your client have some firewall rule that blocks the packets with low TTL. Try to use another device without changing TTL and see if it works.
Also to check if your ISP block packets with low TTL try this:

ping -t 30 8.8.8.8

Offline

#153 2015-01-30 09:54:45

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

Or maybe your router change the TTL.. Run the following on your AP computer and give me the output:

ping -c 3 8.8.8.8

Offline

#154 2015-02-02 11:25:53

Cz-David
Member
Registered: 2012-05-25
Posts: 33

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

I thought about it some more, and it seems I figured it out. Every incoming packet to my internal IP has TTL set to 0. Therefore packets that have been routed trough me cannot be routed back and TTL exceeded is generated. By applying TTL 64 in prerouting I am allowing my tcpip stack to route it back to the sub network.

I wonder if this is a standard subnet blocking solution or someone had a clever idea...

Offline

#155 2015-03-09 15:42:34

utopyand
Member
Registered: 2012-09-05
Posts: 33

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

Weird idea: a proposal to incorporate this script in NetworkManager.

Offline

#156 2015-03-10 07:14:51

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

I think it will be more flexible if it will be rewritten inside NetworkManager with libnm, but this should be another project.
Personally I don't have the time to do it, so if someone wants to rewrite it for NM then he/she can take my ideas from create_ap.

Offline

#157 2015-03-15 18:32:35

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,896
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

Thought I would give create_ap another go, using the following hardware

Bus 002 Device 004: ID 7392:7811 Edimax Technology Co., Ltd EW-7811Un 802.11n Wireless Adapter [Realtek RTL8188CUS]

Passed this command

 sudo create_ap -n -g <ip_address> wlp0s29u1u5 ArchAP

Fired up lighttpd set server to bind to the my ip_address and I was able to connect and see my index.html.

Passed '-n' as I really do not need to share net connection

Amazing script thanks for sharing


Mr Green

Offline

#158 2015-03-17 08:09:23

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,896
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

Have got access point running but when I try to connect to it, connection drops out. Have got lighttpd running on my given ip address (not sure if that is correct) Not really sure how to get connected to access point in a simple way to test?


Mr Green

Offline

#159 2015-03-17 09:23:28

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

The simplest way is the one that you have in your previous post.
If you're using EW-7811Un then try again with Realtek drivers. I have a howto here: https://github.com/oblique/create_ap/bl … realtek.md
Also, can you give me the output of create_ap?

Offline

#160 2015-03-24 17:24:36

elav
Member
From: /var/www/archforum
Registered: 2011-12-24
Posts: 33
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

Hey.. For a couple of days ago, my phone does not find the WiFi signal sent by create_ap .. When I run the command I get this:

sudo ./create_ap --hidden wlp2s0 enp1s0 SSID password                                                                    
Config dir: /tmp/create_ap.wlp2s0.conf.23mxJ3k1
PID: 7052
Network Manager found, set ap0 as unmanaged device... DONE
Creating a virtual WiFi interface... ap0 created.
Access Point's SSID is hidden!
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp2s0.conf.23mxJ3k1/hostapd_ctrl
Configuration file: /tmp/create_ap.wlp2s0.conf.23mxJ3k1/hostapd.conf
sh: /usr/bin/ovs-vsctl: No such file or directory
Using interface ap0 with hwaddr 68:17:29:be:ff:6a and ssid "LenovoMI"
ap0: interface state UNINITIALIZED->ENABLED
ap0: AP-ENABLED 

look this:

sh: /usr/bin/ovs-vsctl: No such file or directory

So, I installed openvswitch:

sudo pacman -S openvswitch

and then:

sudo ./create_ap --hidden wlp2s0 enp1s0 SSID password  
Config dir: /tmp/create_ap.wlp2s0.conf.6AREedJw
PID: 7305
Network Manager found, set ap0 as unmanaged device... DONE
Creating a virtual WiFi interface... ap0 created.
Access Point's SSID is hidden!
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp2s0.conf.6AREedJw/hostapd_ctrl
Configuration file: /tmp/create_ap.wlp2s0.conf.6AREedJw/hostapd.conf
ovs-vsctl: unix:/run/openvswitch/db.sock: database connection failed (No such file or directory)
Using interface ap0 with hwaddr 68:17:29:be:ff:6a and ssid "LenovoMI"
ap0: interface state UNINITIALIZED->ENABLED
ap0: AP-ENABLED 

Now say:

ovs-vsctl: unix:/run/openvswitch/db.sock: database connection failed (No such file or directory)

I try this:

sudo systemctl start ovsdb-server.service                   
sudo systemctl start ovs-vswitchd.service 

and then:

sudo ./create_ap --hidden wlp2s0 enp1s0 SSID password  
Config dir: /tmp/create_ap.wlp2s0.conf.nB9R4DcL
PID: 7524
Network Manager found, set ap0 as unmanaged device... DONE
Creating a virtual WiFi interface... ap0 created.
Access Point's SSID is hidden!
Sharing Internet using method: nat
hostapd command-line interface: hostapd_cli -p /tmp/create_ap.wlp2s0.conf.nB9R4DcL/hostapd_ctrl
Configuration file: /tmp/create_ap.wlp2s0.conf.nB9R4DcL/hostapd.conf
ovs-vsctl: no interface named ap0
Using interface ap0 with hwaddr 68:17:29:be:ff:6a and ssid "LenovoMI"
ap0: interface state UNINITIALIZED->ENABLED
ap0: AP-ENABLED

ovs-vsctl: no interface named ap0

And don't work.. Help!

Offline

#161 2015-03-24 18:04:23

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

It looks like in hostapd 2.4 they use openvswitch to do some things. I will investigate it this week. For a workaround you can downgrade hostapd to 2.3.

Offline

#162 2015-03-24 18:07:22

elav
Member
From: /var/www/archforum
Registered: 2011-12-24
Posts: 33
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

OBLiQUE wrote:

It looks like in hostapd 2.4 they use openvswitch to do some things. I will investigate it this week. For a workaround you can downgrade hostapd to 2.3.

Thanks.. I waiting!

Offline

#163 2015-03-24 20:18:39

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

I found that openvswitch support is not added on the official hostapd code, but it's a custom patch on Arch's hostapd. If you remove openvswitch (and just ignore the error), hostapd will behave normally as before.
If you remove openvswitch but you still have some problems, then it's probably something else.

Offline

#164 2015-03-24 20:36:05

elav
Member
From: /var/www/archforum
Registered: 2011-12-24
Posts: 33
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

I removed openvswitch and nothing happens.. it's probably something else sad

Offline

#165 2015-03-24 20:41:48

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

Try to change channel, maybe is interfering with other AP. Also, try it without --hidden.

Offline

#166 2015-03-24 20:44:39

elav
Member
From: /var/www/archforum
Registered: 2011-12-24
Posts: 33
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

without --hidden it's works!! big_smile

Offline

#167 2015-03-24 20:48:05

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

The --hidden hides the name of the AP and the client must know about it. Did you want to use this feature or you use it by mistake?

Offline

#168 2015-03-24 20:49:07

elav
Member
From: /var/www/archforum
Registered: 2011-12-24
Posts: 33
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

I want to use it .. sad

Offline

#169 2015-03-24 21:04:29

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

Some clients (for example android) they don't show access points with hidden SSID.
What you have to do is to add manually the wifi AP, choose that type of encryption that it has, type the passphrase and then connect to them manually because the client can not detect them.

This is the normal behavior if you want to use --hidden option.
If you have any trouble on configuring your client, then just google how you can add a hidden wifi on it.

If you want to make your life simpler, then don't use --hidden..

Offline

#170 2015-03-31 05:05:30

batzi2014
Member
Registered: 2015-03-31
Posts: 5

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

hello,

i have some trouble connecting to a pptp server through create_ap in nated mode.
anyone has an idea ?

Thanks

Last edited by batzi2014 (2015-03-31 05:34:14)

Offline

#171 2015-03-31 06:24:05

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

If you don't use create_ap, does it connects successfully? Do you have firewall? Also, check your PPTP configuration.

Offline

#172 2015-03-31 06:33:35

batzi2014
Member
Registered: 2015-03-31
Posts: 5

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

thanks for the fast reply. Yes it definitly works i connect (wlan) to my modem router directly. But using my homeserver with your script - it doesnt connect.

So just to be sure - VPN (pptp) is working without problems with your script?

Thanks

update: connecting through create_ap
PPTP port-mapping for en0 inconsistent. is Connected: 1, Previous interface: 4, Current interface 0

update2:
create_ap offers me a network 192.168.12.1/24 and my network is 192.168.100.1/24. iam able when connected to 12.1 to access all componentes on 100.1 and the outside world. but only vpn is struggeling.

Last edited by batzi2014 (2015-03-31 06:56:03)

Offline

#173 2015-03-31 06:49:01

OBLiQUE
Member
Registered: 2008-12-04
Posts: 107
Website

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

I never tried it but I don't think my script is the problem. It's probably something in the PPTP configuration or a firewall rule.
Connect to PPTP without using create_ap and give me the output of:

iptables -S
iptables -t nat -S

Then run create_ap and run the above commands again (on the computer that create_ap runs).

Offline

#174 2015-03-31 07:48:51

batzi2014
Member
Registered: 2015-03-31
Posts: 5

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

Hi

without create_ap
iptables -S

-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N fail2ban-ssh
-A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh
-A fail2ban-ssh -j RETURN

iptables -t nat -S

-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT

with create_ap
iptables -S

-P INPUT ACCEPT
-P FORWARD ACCEPT
-P OUTPUT ACCEPT
-N fail2ban-ssh
-A INPUT -p udp -m udp --dport 67 -j ACCEPT
-A INPUT -p udp -m udp --dport 53 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT
-A INPUT -p tcp -m multiport --dports 22 -j fail2ban-ssh
-A FORWARD -d 192.168.100.0/24 -i p4p1 -j ACCEPT
-A FORWARD -s 192.168.100.0/24 -i ap0 -j ACCEPT
-A fail2ban-ssh -j RETURN

iptables -t nat -S

-P PREROUTING ACCEPT
-P INPUT ACCEPT
-P OUTPUT ACCEPT
-P POSTROUTING ACCEPT
-A POSTROUTING -o p4p1 -j MASQUERADE

thanks for your help

Last edited by batzi2014 (2015-03-31 09:17:20)

Offline

#175 2015-03-31 14:08:56

b4nst0n
Member
Registered: 2013-08-08
Posts: 50

Re: [script] create_ap: Create a NATed or Bridged WiFi Access Point

system would random crash if using mentohust ( which supports china campus network authentication)
I don't know where to find error log cause it can't do anything while crashing.

EDIT:
Here is 2 ways to connect Internet. ( 2 different agency)
When I use DSL, it seems everything fine.
When I use mentohust, system would random crash and I don't know what is the trigger.

Last edited by b4nst0n (2015-03-31 14:14:49)

Offline

Board footer

Powered by FluxBB