I am trying to use an old laptop as a gateway from wired lan to a wifi internet hotspot:
lan router->ubuntu laptop->internet hotspot
I found a recipe to set up the laptop as a gateway, which "works" as far as forwarding packets, but as soon as I do that, my throughput immediately tanks.
On the laptop:
~$ ping google.com
PING google.com (142.250.176.14) 56(84) bytes of data.
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=1 ttl=112 time=41.7 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=2 ttl=112 time=52.3 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=3 ttl=112 time=50.7 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=4 ttl=112 time=38.6 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=5 ttl=112 time=46.6 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=6 ttl=112 time=44.7 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=7 ttl=112 time=52.5 ms
^C
--- google.com ping statistics ---
7 packets transmitted, 7 received, 0% packet loss, time 6011ms
rtt min/avg/max/mdev = 38.590/46.719/52.463/4.997 ms
~$ sudo iptables -A FORWARD -o wlp2s0 -i enp3s0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT
~$ sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT
~$ sudo iptables -t nat -F POSTROUTING
~$ sudo iptables -t nat -A POSTROUTING -o wlp2s0 -j MASQUERADE
~$ ping google.com
PING google.com (142.250.176.14) 56(84) bytes of data.
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=1 ttl=112 time=3788 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=2 ttl=112 time=3594 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=3 ttl=112 time=3307 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=4 ttl=112 time=3670 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=5 ttl=112 time=3894 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=6 ttl=112 time=3947 ms
64 bytes from lax17s51-in-f14.1e100.net (142.250.176.14): icmp_seq=7 ttl=112 time=4091 ms
^C
--- google.com ping statistics ---
11 packets transmitted, 7 received, 36.3636% packet loss, time 13691ms
rtt min/avg/max/mdev = 3307.409/3755.984/4090.852/240.026 ms, pipe 5
I don't know much about iptables settings, but obviously something not quite right.
EDIT: Just in case it matters, the laptop's specs are:
- Turion M500 (64bit 2-core)
- 4gig ram
- wireless: RTL8191SEvB
- ethernet: RTL810xE