Mail, Mail/Mutt, Mail/mbsync, iptables, nmap, ntpdate, route, ssh, ssh/scp, ssh/sshfs, wlan

Guide to IP Layer Network Administration with Linux
Linux Home Networking
Heise Netzwerkrechner

Connect two laptops and share internet access

Connect two Linux machines via ethernet
ArchLinux Wiki: Internet share
Connecting to a network via another pc

Assuming that

  • Laptop-1 is connected with internet via wlan to router/gateway
  • Laptop-2 is connected with Laptop-1 via lan

Note: Ensure that both laptops are connected together within another subnet as for the wireless network


Setup ethernet card

# ifconfig eth0 netmask up

Enable forwarding

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

Use iptables to enable NAT

# iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE

Don't know... but for me it works without these 2 commands too?
# iptables -A FORWARD -i eth0 -o wlan0 -j ACCEPT
# iptables -A FORWARD -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT


Setup ethernet card

# ifconfig eth0 netmask up

Route through Laptop-1's gateway

route add default gw
Last modified 4 years ago Last modified on Dec 17, 2014, 10:11:05 AM