어떤 이유로 고정 IP 주소를 설정하려고하면 내 eth0이 ifconfig
출력 에서 사라집니다 . 게이트웨이 랩톱에서 Ubuntu 서버 12.10을 실행하고 있습니다.
auto eth0
iface eth0 inet dhcp
그런 다음 내가 실행할 때이 출력을 제공합니다 ifconfig
.
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:192.168.1.101 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::2e0:b8ff:fee7:f71c/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:281 errors:0 dropped:0 overruns:0 frame:0
TX packets:352 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:31874 (31.8 KB) TX bytes:45369 (45.3 KB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:430 errors:0 dropped:0 overruns:0 frame:0
TX packets:430 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:41740 (41.7 KB) TX bytes:41740 (41.7 KB)
정적으로 변경하면 :
auto eth0
iface eth0 inet static
address 192.168.1.37
netmask 225.225.225.0
gateway 192.168.1.1
…을 실행 service networking restart
하면 루프백 블록 만 가져옵니다 ifconfig
.
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:430 errors:0 dropped:0 overruns:0 frame:0
TX packets:430 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:41740 (41.7 KB) TX bytes:41740 (41.7 KB)
그러나 고정 IP를 사용하여 강제로 할 수 는 ifconfig eth0 192.168.1.37 netmask 255.255.255.0
있지만 재부팅하면 분명히 사라집니다.
한 가지 방법은 효과가 있지만 다른 방법은 효과가없는 이유는 무엇입니까? 내가 뭔가 잘못하고 있습니까?
답변
오타였습니다. 넷 마스크로 255.255.255.0을 사용하고 대신 225.225.225.0을 입력 했어야합니다.
내 길의 오류를 볼 수 있도록 도와 준 qbi에게 감사
답변
하지 마십시오 service networking restart
; 더 이상 사용되지 않습니다.
대신에 그런 ifdown eth0
다음 ifup eth0
또는 단순히 재부팅하십시오.