Take the diagram below as example.
- Computer A has the internet connection via either wireless lan or wireless broadband(either wlan0 or ppp0)
- Computer B and C will connect to computer A to use the internet connection(belong to computer A)
- Computer A got 2 ethernet port named eth0 and eth1 both connected to computer B and C respectively
- Justify interface name that has internet connection at Computer A. Run command "ifconfig" (ignore the quote). In this case, I will assume interface name ppp0(mobile broadband) that has an access to the internet.
- Run the command "iptables -t nat -A POSTROUTING -o XXXX -j MASQUERADE" (replace xxxx with the interface name you obtained earlier..in this case ppp0)
- Next, run the the command "echo 1 > /proc/sys/net/ipv4/ip_forward"
- Connect PC A and B with ethernet cable. Open "edit connection". Set/edit wired connection like below. If none available to edit, create new.
PC A
IP Address: 192.168.1.100
Netmask: 24
Gateway: 0.0.0.0
DNS: Enter the DNS server you obtained earlier.
PC B
IP Address: 192.168.1.101
Netmask: 24
Gateway: 192.168.1.100(point back to PC A)
DNS: Enter the DNS server you obtained earlier.
Edit the eth0 or Create new - Click apply. Disconnect wired connection and and reconnect. Make sure both PC use the specified address. If not prevail, try again.
- Try access internet from both computer.
- Repeat step 4 to setup PC A and PC C.
- You also can use subnetting. Just enter appropriate subnet mask and ip address
- If you want to connect between PC with wireless also no problem. Just set proper value in "wireless" tab in "edit connection" setting..
No comments:
Post a Comment
Your comment is much appreciated. Thanks :)