- http://crowz.kr/index.php?category=1477&mid=Linux&document_srl=504
- htp://gabrielkim.tistory.com/33
System :: Ubuntu 12.04 64Bits , Ethernet Card 2 Ea (eth0, eth1)
- 공유기 Hub로 사용되는 port :: eth1
1. Network 설정
$ sudo vi /etc/network/interfaces
auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
auto eth1
iface eth1 inet static
address 192.168.0.1
netmask 255.255.255.0
broadcast 192.168.0.255
network 192.168.0.0
$ sudo /etc/init.d/networking restart
cf) host file을 수정하면 host 명으로 접속가능하다.
$ sudo vi /etc/hosts
127.0.0.1 localhost
192.168.0.1 ubunturouter
2. 마스커 레이딩 활성화
$ sudo vi /etc/sysctl.conf
net.ipv4.ip_forward=1 의 주석을 제거.
$ sudo vi /etc/rc.local
아래 두 줄 추가
/sbin/iptables -P FORWARD ACCEPT
/sbin/iptables --table nat -A POSTROUTING -o eth0 -j MASQUERADE
3. dhcp 서버 설치
$ sudo apt-get install isc-dhcp-server
설정)
$ sudo vi /etc/dhcp/dhcpd.conf
ddns-update-style none;
option domain-name "ubunturouter";
option domain-name-servers 156.147.1.1, 156.147.135.180; # eth0의 dns 서버 입력
default-lease-time 3600;
max-lease-time 7200;
authoritative;
log-facility local7;
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.2 192.168.0.254;
option subnet-mask 255.255.255.0;
option broadcast-address 255.255.255.0;
option routers 192.168.0.1;
}
$ sudo vi /etc/default/isc-dhcp-server
INTERFACES="eth1"
$ sudo service isc-dhcp-server restart
cf) arp -n 명령을 이용하면 현재 접속중인 IP 들을 확인 할 수 있다.