Ubuntu : Internet Sharing

#nano /etc/network/interfaces
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

auto eth1
iface eth1 inet static
address 192.168.1.10
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
post-up /usr/local/bin/iptable.sh


#nano /usr/local/bin/iptable.sh
#!/bin/bash
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -F
iptables -t nat -F
iptables -t mangle -F
iptables -X
iptables -P FORWARD ACCEPT
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE


#apt-get install squid3
#nano /etc/squid3/squid.conf
http_port 8080 transparent
acl localnet src 192.168.1.0/24
http_access allow localnet
http_access deny all


#apt-get install dnsmasq
#nano /etc/dnsmasq.conf
interface=eth1
dhcp-range=192.168.1.11,192.168.1.20,12h


script : share-net-script

Comments

Popular posts from this blog

Artillery Hornet + OctoPrint + Klipper

เพิ่ม Font ภาษาไทยให้ OpenElec (Kodi)

Axapta : Query Properties