I'm on holiday, and the wifi here is expensive and restrictive. €15 a week and only one device. I came prepared though, laptop, Wifi access
point and various Android devices.
What I'm trying to do is connect my laptop over Wifi to the hotel network, and then plug my wifi access point into the ethernet of the laptop.
My current IP config is below :-
pance:~ dgs$ ifconfig en1
en1: flags=8963<UP,BROADCAST,SMART,RUNNING,PROMISC,SIMPLEX,MULTICAST> mtu 1500
ether f8:1e:df:f2:5e:f2
inet6 fe80::fa1e:dfff:fef2:5ef2%en1 prefixlen 64 scopeid 0x5
inet 10.192.168.32 netmask 0xffffff00 broadcast 10.192.168.255
media: autoselect
status: active
pance:~ dgs$ ifconfig en0
en0: flags=8863<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
options=2b<RXCSUM,TXCSUM,VLAN_HWTAGGING,TSO4>
ether c4:2c:03:01:a5:51
inet6 fe80::c62c:3ff:fe01:a551%en0 prefixlen 64 scopeid 0x4
inet 192.168.0.1 netmask 0xffffff00 broadcast 192.168.0.255
media: autoselect (100baseTX <full-duplex>
status: active
pance:~ dgs$
en1 is wifi, en0 is ethernet
WAP is on 192.168.0.231. As a test I've configured my phone to connect to the WAP and use a static IP of 192.168.0.3/255.255.255.0 with a
default gateway of 192.168.0.1 (the addr of the ethernet port on the laptop). My laptop routing table is :-
pance:~ dgs$ netstat -r
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default wireless.colubris. UGSc 150 31 en1
10.192.168/24 link#5 UCS 5 0 en1
wireless.colubris. 0:3:52:c:7f:3b UHLWIi 58 3 en1 1194
10.192.168.32 localhost UHS 0 0 lo0
10.192.168.32/32 link#4 UCSI 0 0 en0
10.192.168.77 f0:dc:e2:74:cb:8c UHLWIi 0 0 en1 980
127 localhost UCS 0 0 lo0
localhost localhost UH 2 92212 lo0
169.254 link#5 UCS 1 0 en1
169.254.255.255 0:3:52:c:7f:3b UHLSW 0 0 en1
172.16.19/24 link#8 UC 1 0 vmnet1
192.168.0 link#4 UCS 2 0 en0
192.168.0.1 localhost UHS 0 0 lo0
192.168.0.3 7c:61:93:ef:10:a4 UHLWIi 1 0 en0 1187
192.168.0.231 0:1e:2a:9:6:1c UHLWIi 0 7002 en0 327
192.168.86 link#9 UC 1 0 vmnet8
Nothing seems to get through from my phone to the outside world. If I run wireshark on my ethernet port, I see ARP queries like
120 68.018785 Apple_01:a5:51 Broadcast ARP 42 Who has 10.192.168.32? Tell 192.168.0.1
What have I missed? What magic incantation do I need to route from en0 to en1?
Regards,
Dave
As the Hotel wifi is not aware of you network on 192.168.0.X it can not route any packets back to it, you need to NAT your 192.168.0.X network behide the IP Address of 10.192.168.32.
Magic!
This little bit of jiggery pokery did it :-
$ sudo sysctl -w net.inet.ip.forwarding=1
$ sudo natd -interface en1
$ sudo ipfw add divert natd ip from any to any via en1