0

I have 2 laptops both connected on the same LAN using wifi . In One laptop I have working internet connection which i shared to laptop 2 using Ethernet , as i wanted to create a new gateway on the same LAN , so that clients connected to LAN via my gateway have an access to the internet .

The internet sharing via ethernet is working on laptop 2 and for the ethernet interface and the ip configuration are as

eth0
Connection mode - Shared to other Computers
IP - 192.168.137.2
Subnet -24
Gateway - 192.168.137.1
DNS - 8.8.8.8 ,4.4.4.4

The ip configuration of wireless interface wlan0 on the same compute are as follows (This interface will act as gateway )

wlan0
Connection mode - Manual
IP - 192.168.144.111
Subnet -24
Gateway - EMPTY
DNS - EMPTY

The clients connected on the same network have ip configuaration as

interface - eth0/wlan0
Connection mode - Manual
IP - 192.168.144.X
Subnet -24
Gateway - 192.168.144.111
DNS - 8.8.8.8 ,4.4.4.4

I have enabled ip_forwarding in my linux pc but clients connected to same subnet are not able to connect to the internet.

closed as unclear what you're asking by G-Man, Romeo Ninov, Kiwy, Jesse_b, LinuxSecurityFreak May 3 '18 at 6:32

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

1

You'll need to enable ip_forwarding:

echo 1 >/proc/sys/net/ipv4/ip_forward

Set a default route out of eth0:

ip route add default via 192.168.137.1

Then tell clients on the wlan0 LAN to use 192.168.144.111 as their gateway. If you control the dhcp server, change your gateway in the dhcp config.

You'll probably need to set up NAT as well, if you want clients on 192.168.144.0/24 to connect to the internet:

iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

  • Still not working Error On Client Sides "err name not resolved" what should be my defalut gateway address for my wlan0 and DNS address. – Sumit Joshi May 2 '18 at 6:39
  • Clients on the wlan0 LAN should use the IP address on the wlan0 interface of your linux machine as the default gateway, so 192.168.144.111. – rusty shackleford May 2 '18 at 8:28
  • "err name not resolved" - your clients can't reach a DNS server, you could set their DNS to 8.8.8.8 (or to whatever your linux machine is using as it's DNS server), which would then be routed via the default gateway and natted when it comes out of the eth0 interface. – rusty shackleford May 2 '18 at 8:32

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