Network address translation (NAT) is the process of modifying network address information in IP packet headers while in transit across a traffic routing device for the purpose of remapping a given address space into another. Almost all modern Operating system provides NAT support. In other words, if your Mac book connected to the Internet, you can share its Internet connection with other computers on your LAN.
In this example, your Macbook is connected to the Internet via Airport and you are sharing the Internet via Ethernet which is connected to your desktop. Airport gets a public IP address via ISP connection and Ethernet has the following manual IP settings:
WARNING! These examples may stop networking and the Internet on your laptop and desktop computer if not executed with care. You must have basic understanding of TCP/IP networking.
Turn On Internet Sharing
Open System Preferences by visiting Apple menu > System Preferences:Click Sharing:
Select Internet Sharing:
You need to select your Internet connection using Airport. Also use select "Ethernet". Change these settings as per your requirement.
How Do I Use Shared Internet Connection On Other Computers?
You need to input the following networking settings for desktop computer called desktop1:- IP address 192.168.2.2
- IP netmask 255.255.255.0
- IP gateway 192.168.2.1
- IP DNS server 192.168.2.1
auto eth0
iface eth0 inet static
address 192.168.2.2
netmask 255.255.255.0
network 192.168.2.0
broadcast 192.168.2.255
gateway 192.168.2.1
How Do I Setup Port Forwarding OS X Router?
Macbook OS X has no direct GUI option to configure port forwarding. However, you can create a shell script as follows (open terminal and create a script called osx_fw.sh):#!/bin/bashSimply run this script whenever you need to forward ports:
# bit-torrent port forwarding with mac os x
killall -9 natd
sleep 5
# The following will forward 6881 to 6999 port to desktop computer located at 192.168.2.2
# 192.168.1.100 => airport IP
# 192.168.2.2 => Desktop client ip
# natd provides a Network Address Translation facility for use with divert(4) sockets under FreeBSD.
# -------------------------------------------------------------------------------------------------
/usr/sbin/natd -alias_address 192.168.1.100 -interface en1 -use_sockets -same_ports -unregistered_only -dynamic -clamp_mss -enable_natportmap -natportmap_interface en0 -redirect_port tcp 192.168.2.2:6881-6999 6881-6999 -l
chmod +x osx_fw.sh
sudo ./osx_fw.sh
Sample ipfw rules
Type the following command to list current rules (these are set by above Internet sharing procedure):sudo ipfw list
Sample outputs:00010 divert 8668 ip from any to any via en1See ipfw man page to secure your network via firewall. My Ubuntu desktop connected to transmission BT client:
33300 deny log icmp from any to me in icmptypes 8
65535 allow ip from any to any
No comments:
Post a Comment