1、修改配置檔案/etc/network/interfacesroot@ubuntu:~#sudogedit/etc/network/interfaces新增以下內容:autoeth0#設定自動啟動eth0介面ifaceeth0inetstatic#配置靜態IPaddress192.168.11.88#IP地址netmask255.255.255.0#子網掩碼gateway192.168.11.1#預設閘道器2、修改DNSsudogedit/etc/resolve.confnameserver127.0.0.1#記得加上nameserver8.8.8.8#當地dns伺服器(用ipconfig/all檢視本地dns,第一個dns是預設的,共有2個dns)注:#後面的註釋資訊不要加進去。3、重啟網路,使配置生效sudo/etc/init.d/networkingrestart4、檢視ip是否配置成功root@ubuntu:~#ifconfigeth0Linkencap:EthernetHWaddr00:0c:29:2d:89:40inetaddr:192.168.11.88Bcast:192.168.11.255Mask:255.255.255.0inet6addr:fe80::20c:29ff:fe2d:8940/64Scope:LinkUPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1RXpackets:223errors:0dropped:0overruns:0frame:0TXpackets:253errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:1000RXbytes:24219(24.2KB)TXbytes:22960(22.9KB)Interrupt:19Baseaddress:0×2024loLinkencap:LocalLoopbackinetaddr:127.0.0.1Mask:255.0.0.0inet6addr:::1/128Scope:HostUPLOOPBACKRUNNINGMTU:16436Metric:1RXpackets:48errors:0dropped:0overruns:0frame:0TXpackets:48errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:0RXbytes:3964(3.9KB)TXbytes:3964(3.9KB)root@ubuntu:~#注:紅字加粗“192.168.11.88”跟上面配置的ip一樣,表示ip配置成功。如果網路無法啟動或不穩定,可嘗試如下操作:gedit/etc/NetworkManager/NetworkManager.confmanaged=false設定成managed=true
1、修改配置檔案/etc/network/interfacesroot@ubuntu:~#sudogedit/etc/network/interfaces新增以下內容:autoeth0#設定自動啟動eth0介面ifaceeth0inetstatic#配置靜態IPaddress192.168.11.88#IP地址netmask255.255.255.0#子網掩碼gateway192.168.11.1#預設閘道器2、修改DNSsudogedit/etc/resolve.confnameserver127.0.0.1#記得加上nameserver8.8.8.8#當地dns伺服器(用ipconfig/all檢視本地dns,第一個dns是預設的,共有2個dns)注:#後面的註釋資訊不要加進去。3、重啟網路,使配置生效sudo/etc/init.d/networkingrestart4、檢視ip是否配置成功root@ubuntu:~#ifconfigeth0Linkencap:EthernetHWaddr00:0c:29:2d:89:40inetaddr:192.168.11.88Bcast:192.168.11.255Mask:255.255.255.0inet6addr:fe80::20c:29ff:fe2d:8940/64Scope:LinkUPBROADCASTRUNNINGMULTICASTMTU:1500Metric:1RXpackets:223errors:0dropped:0overruns:0frame:0TXpackets:253errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:1000RXbytes:24219(24.2KB)TXbytes:22960(22.9KB)Interrupt:19Baseaddress:0×2024loLinkencap:LocalLoopbackinetaddr:127.0.0.1Mask:255.0.0.0inet6addr:::1/128Scope:HostUPLOOPBACKRUNNINGMTU:16436Metric:1RXpackets:48errors:0dropped:0overruns:0frame:0TXpackets:48errors:0dropped:0overruns:0carrier:0collisions:0txqueuelen:0RXbytes:3964(3.9KB)TXbytes:3964(3.9KB)root@ubuntu:~#注:紅字加粗“192.168.11.88”跟上面配置的ip一樣,表示ip配置成功。如果網路無法啟動或不穩定,可嘗試如下操作:gedit/etc/NetworkManager/NetworkManager.confmanaged=false設定成managed=true