CH7. 데비안에서 고정 ip를 설정하는 방법
[고정 IP 사용시] 1. 중지 sudo ifdown eth0 2. 네트워크 인터페이스 설정 sudo vi /etc/network/interfaces ---------------------------------------------- auto lo iface lo inet loopback auto eth0 iface eth0 inet static address xxx.xxx.xxx.xxx netmask 255.255.255.0 network xxx.xxx.xxx.0 broadcast xxx.xxx.xxx.255 gateway xxx.xxx.xxx.254 dns-nameservers 8.8.8.8 8.8.4.4 3. 네임 서버 설정 $ sudo vi /etc/resolv.conf nameserver 8.8.8.8 nameserver 8.8.4.4 4. 동작 sudo ifup eth0 [유동 IP 사용시] sudo vi /etc/network/interfaces ---------------------------------------------- auto lo iface lo inet loopback allow-hotplug eth0 iface eth0 inet dhcp
[하나의 랜카드에 2개이상의 IP설정] (가상이더넷 설정) sudo vi /etc/network/interfaces ------------------------------------------------------------- auto lo allow-hotplug eth0 iface lo inet loopback # The primary network interface auto eth0 iface eth0 inet static address 165.133.32.32 netmask 255.255.255.0 network 165.133.32.0 broatcast 165.133.32.255 gateway 165.133.32.254 dns-nameservers 8.8.8.8 8.8.4.4 auto eth0:0 iface eth0:0 inet static address 192.168.1.32 netmask 255.255.255.0 [참고] sudo apt-get install ifplugd sudo dpkg-reconfigure ifplugd
$vim /etc/network/interfaces auto eth0 ^iface eth0 inet static ^^^^address xxx.xxx.xxx.xxx ^^^^netmask 255.255.255.0 ^^^^network xxx.xxx.xxx.0 ^^^^broadcast xxx.xxx.xxx.255 ^^^^gateway xxx.xxx.xxx.254 ^^^^dns-nameservers 8.8.8.8 8.8.4.4 이렇게 띄어쓰기를 하면 해결된다. Reboot 후, 셋팅이 제대로 먹히면 ifdown ifup 모두 잘된다. 또, ip도 원하는 ip로 변경된다.
$ifconfig $ifconfig $ifconfig