求助,ub下修改ip地址问题

包含网卡/无线网的网络问题和ADSL/校园网/宽带拨号支持及代理/共享等网络使用问题
回复
zjxfly
帖子: 4
注册时间: 2017-03-16 10:39
系统: win10

求助,ub下修改ip地址问题

#1

帖子 zjxfly » 2017-03-16 10:56

在/etc/network/interfaces

下修改了ip地址,网关
居然用ifconfig查看是只变了ip,没有变化网管
之前是192.168.1.16,gw:192.168.1.1
修改为192.168.0.16,gw:192.168.0.1
但是查看的时候不一样;

eth0 inet 192.168.0.16 Bcast:192.168.1.255 mask:255.255.255.0


这里的bcast 不该变成192.168.0.255吗!!!!,现在看的还是修改之前的那个地址!!
:Sad :Sad :Sad :Sad
zjxfly
帖子: 4
注册时间: 2017-03-16 10:39
系统: win10

Re: 求助,ub下修改ip地址问题

#2

帖子 zjxfly » 2017-03-16 11:29

请大虾们帮我一下啦,什么情况呢。。。。/etc/network/interfaces
中静态地址明明是192.168.0.1,怎么ifconfig查看的时候还是原来的呢!
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 求助,ub下修改ip地址问题

#3

帖子 poloshiao » 2017-03-16 11:34

/etc/network/interfaces
把下面的指令 複製 貼進終端機 執行
1. sudo cat /etc/network/interfaces
2. sudo ifconfig -a
3. sudo route -n -v
把結果 直接全部複製貼上來
zjxfly
帖子: 4
注册时间: 2017-03-16 10:39
系统: win10

Re: 求助,ub下修改ip地址问题

#4

帖子 zjxfly » 2017-03-16 12:18

root@nuc-1:~# cat /etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo eth0 eth0:1
iface lo inet loopback


iface eth0 inet static
address 192.168.0.16
netmask 255.255.254.0
gateway 192.168.0.1

iface eth0:1 inet static
address 10.2.0.2
netmask 255.255.255.0
root@nuc-1:~#
root@nuc-1:~# ifconfig -a
docker0 Link encap:Ethernet HWaddr 02:42:e9:a5:1a:5e
inet addr:172.17.0.1 Bcast:0.0.0.0 Mask:255.255.0.0
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)

eth0 Link encap:Ethernet HWaddr b8:ae:ed:e9:a7:f1
inet addr:192.168.0.16 Bcast:192.168.1.255 Mask:255.255.254.0
inet6 addr: fe80::baae:edff:fee9:a7f1/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:346803 errors:0 dropped:2 overruns:0 frame:0
TX packets:4078 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:23438187 (23.4 MB) TX bytes:374607 (374.6 KB)
Interrupt:20 Memory:aa100000-aa120000

eth0:1 Link encap:Ethernet HWaddr b8:ae:ed:e9:a7:f1
inet addr:10.2.0.2 Bcast:10.2.0.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Interrupt:20 Memory:aa100000-aa120000

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:65536 Metric:1
RX packets:31320 errors:0 dropped:0 overruns:0 frame:0
TX packets:31320 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:23564363 (23.5 MB) TX bytes:23564363 (23.5 MB)

wlan0 Link encap:Ethernet HWaddr 00:21:5c:d3:75:75
UP BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
root@nuc-1:~# route -n -v
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
0.0.0.0 192.168.0.1 0.0.0.0 UG 0 0 0 eth0
10.2.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
169.254.0.0 0.0.0.0 255.255.0.0 U 1000 0 0 eth0
172.17.0.0 0.0.0.0 255.255.0.0 U 0 0 0 docker0
192.168.0.0 0.0.0.0 255.255.254.0 U 0 0 0 eth0
root@nuc-1:~#
poloshiao
论坛版主
帖子: 18279
注册时间: 2009-08-04 16:33

Re: 求助,ub下修改ip地址问题

#5

帖子 poloshiao » 2017-03-16 14:29

你是想設定這個嗎 ?

https://philipzheng.gitbooks.io/docker_ ... d_network/

图片
/etc/network/interfaces
# interfaces(5) file used by ifup(8) and ifdown(8)
auto lo eth0 eth0:1
iface lo inet loopback
iface eth0 inet static
address 192.168.0.16
netmask 255.255.254.0
gateway 192.168.0.1
iface eth0:1 inet static
address 10.2.0.2
netmask 255.255.255.0
你如此設定的資料 如果有參考什麼網頁 請提供網址 可以節省一些時間
zjxfly
帖子: 4
注册时间: 2017-03-16 10:39
系统: win10

Re: 求助,ub下修改ip地址问题

#6

帖子 zjxfly » 2017-03-16 18:56

我在修改之前是能上网的。。
路由器的网关变了,所以修改了ip就是那个网卡的网关地址即使修改了,可是ifconfig看到的还是原来的。。
onlylove
论坛版主
帖子: 5230
注册时间: 2007-01-14 16:23

Re: 求助,ub下修改ip地址问题

#7

帖子 onlylove » 2017-03-16 21:09

iface eth0 inet static
address 192.168.0.16
netmask 255.255.254.0
gateway 192.168.0.1
回复