ubuntu下ad-hoc共享上网

sudo ifconfig wlan0 down
sudo iwconfig wlan0 mode ad-hoc
sudo iwconfig wlan0 essid “yingouqlj”
sudo ifconfig wlan0 192.168.0.1 netmask 255.255.255.0
sudo iptables -F
sudo iptables -P INPUT ACCEPT
sudo iptables -P FORWARD ACCEPT

sudo iptables -t nat -A POSTROUTING -o etho -j MASQUERADE
sudo iptables -t nat -A POSTROUTING -s 192.168.137.0/24 -o eth0 -j MASQUERADE

sudo vim /etc/sysctl.conf
去注释 net.ipv4.ip_forward = 1

你可能感兴趣的:(test,ubuntu,ad-doc)