Total Pageviews

Popular Posts

Wednesday, July 02, 2014

Sharing Wireless Internet To Ethernet

Sometimes we need to share our wireless internet to an ethernet connected clients or anything else such as wireless access points or network switches.

In my situation, my smartphone can not connect directly to my preferred primary wireless access point. So i need to setup a simple wireless repeater.

First is first, i need to connect to the primary wireless access point using my pc.

After that, i configure my pc as a client to relay the internet to my secondary access point which is tp-link wireless access point and it already has its own DHCP server. I dont need to configure any DHCP server then.

My wireless adapter on my pc connected to the primary wireless access point is wlan1. This is how i do it.

internet --> wlan1 (on my pc) --> ethernet (on my pc too) --> network cable --> tp-link wireless access point --> smartphone

For your info, i already configured my tp-link wireless access point to match my ethernet configurations (IPs, Subnets, gateways).

All i need to do after connecting to primary wireless access point is run this commands.

ip link set up dev eth0
ip addr add 192.168.137.1/24 dev eth0 
sysctl net.ipv4.ip_forward=1
iptables -t nat -A POSTROUTING -o wlan1 -j MASQUERADE
iptables -A FORWARD -i eth0 -o wlan1 -j ACCEPT
iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT

take note that my ethernet is eth0.