怎么在ubantu系統(tǒng)下設(shè)置ip?
1、修改配置文件/etc/network/interfacesroot@ubuntu:~#sudogedit/etc/network/interfaces添加以下內(nèi)容:autoeth0#設(shè)置自動啟動eth0接口ifaceeth0inetstatic#配置靜態(tài)IPaddress192.168.11.88#IP地址netmask255.255.255.
0#子網(wǎng)掩碼gateway192.168.11.
1#默認網(wǎng)關(guān)2、修改DNSsudogedit/etc/resolve.confnameserver127.0.0.
1#記得加上nameserver8.8.8.8#當?shù)豥ns服務器(用ipconfig/all查看本地dns,第一個dns是默認的,共有2個dns)注:#后面的注釋信息不要加進去。
3、重啟網(wǎng)絡(luò),使配置生效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配置成功。如果網(wǎng)絡(luò)無法啟動或不穩(wěn)定,可嘗試如下操作:
gedit/etc/NetworkManager/NetworkManager.confmanaged=false設(shè)置成managed=true