![为什么我无法从 Ubuntu Linux 15.10 计算机 ping 通默认网关 192.168.10.1,但可以从 Windows 7 执行此操作?](https://linux22.com/image/83997/%E4%B8%BA%E4%BB%80%E4%B9%88%E6%88%91%E6%97%A0%E6%B3%95%E4%BB%8E%20Ubuntu%20Linux%2015.10%20%E8%AE%A1%E7%AE%97%E6%9C%BA%20ping%20%E9%80%9A%E9%BB%98%E8%AE%A4%E7%BD%91%E5%85%B3%20192.168.10.1%EF%BC%8C%E4%BD%86%E5%8F%AF%E4%BB%A5%E4%BB%8E%20Windows%207%20%E6%89%A7%E8%A1%8C%E6%AD%A4%E6%93%8D%E4%BD%9C%EF%BC%9F.png)
我无法从 Ubuntu Linux 15.10 计算机 192.168.10.22 ping 通默认网关 192.168.10.1。但我可以从 Windows 7 计算机 192.168.10.15 ping 通默认网关 192.168.10.1。网络掩码是 255.255.255.0 。这样一来,两台计算机就在同一个网段了。
这与专家告诉我我的 Ubuntu Linux 网络配置文件/etc/network/interfaces
搞砸了有什么关系吗?
这里是:
#interfaces(5) file used by ifup(8) and ifdown(8)
auto lo
iface lo inet loopback
修正后的样子应该是什么样/etc/network/interfaces
的?
vendat@vendat-ThinkStation-S10:~$ ip address show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: enp13s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether 00:1e:37:f4:59:b2 brd ff:ff:ff:ff:ff:ff
3: enp15s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000
link/ether 00:1e:37:f4:59:b3 brd ff:ff:ff:ff:ff:ff
inet 192.168.10.22/24 brd 192.168.10.255 scope global enp15s0
valid_lft forever preferred_lft forever
inet6 2606:a000:8301:2d00:21e:37ff:fef4:59b3/64 scope global noprefixroute dynamic
valid_lft 3603sec preferred_lft 3603sec
inet6 fe80::21e:37ff:fef4:59b3/64 scope link
valid_lft forever preferred_lft forever
vendat@vendat-ThinkStation-S10:~$ ip route show
default via 192.168.10.1 dev enp15s0 proto static metric 100
169.254.0.0/16 dev enp15s0 scope link metric 1000
192.168.10.0/24 dev enp15s0 proto kernel scope link src 192.168.10.22 metric 100
我应该在 Windows 7 计算机上哪里查找添加到 Ubuntu Linux 所需的信息/etc/network/interfaces
?
结果如下ip link show
:
ThinkStation-S10:/etc$ ip link show
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp13s0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN mode DEFAULT group default qlen 1000
link/ether 00:1e:37:f4:59:b2 brd ff:ff:ff:ff:ff:ff
3: enp15s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DEFAULT group default qlen 1000
link/ether 00:1e:37:f4:59:b3 brd ff:ff:ff:ff:ff:ff
enp15s0
感兴趣的以太网链路在哪里。
Here is thhe sudo tcmpdump -i enp15s0 output. Why are we using it?
vendat@vendat-ThinkStation-S10:~$ sudo tcpdump -n -i enp15s0
[sudo] password for vendat:
tcpdump: verbose output suppressed, use -v or -vv for full protocol decode
listening on enp15s0, link-type EN10MB (Ethernet), capture size 262144 bytes
08:55:15.891889 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 reply
08:55:17.552598 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:17.639375 IP6 fe80::921a:caff:fe80:3337 > 2606:a000:8301:2d00:21e:37ff:fef4:59b3: ICMP6, neighbor solicitation, who has 2606:a000:8301:2d00:21e:37ff:fef4:59b3, length 32
08:55:17.639675 IP6 2606:a000:8301:2d00:21e:37ff:fef4:59b3 > fe80::921a:caff:fe80:3337: ICMP6, neighbor advertisement, tgt is 2606:a000:8301:2d00:21e:37ff:fef4:59b3, length 24
08:55:17.840114 IP6 fe80::921a:caff:fe80:3337 > ff02::1: ICMP6, router advertisement, length 56
08:55:17.891996 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 reply
08:55:18.549060 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:19.549061 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:19.892102 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 reply
08:55:20.840177 IP6 fe80::921a:caff:fe80:3337 > ff02::1: ICMP6, router advertisement, length 56
08:55:21.892211 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 reply
08:55:22.557655 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:22.759777 IP6 fe80::921a:caff:fe80:3337 > fe80::21e:37ff:fef4:59b3: ICMP6, neighbor solicitation, who has fe80::21e:37ff:fef4:59b3, length 32
08:55:22.760077 IP6 fe80::21e:37ff:fef4:59b3 > fe80::921a:caff:fe80:3337: ICMP6, neighbor advertisement, tgt is fe80::21e:37ff:fef4:59b3, length 24
08:55:23.557059 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:23.840340 IP6 fe80::921a:caff:fe80:3337 > ff02::1: ICMP6, router advertisement, length 56
08:55:23.892318 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 reply
08:55:24.557060 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:25.892426 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 reply
08:55:26.840686 IP6 fe80::921a:caff:fe80:3337 > ff02::1: ICMP6, router advertisement, length 56
08:55:27.892534 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 query
08:55:28.565074 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:29.565102 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:29.840687 IP6 fe80::921a:caff:fe80:3337 > ff02::1: ICMP6, router advertisement, length 56
08:55:29.892641 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 query
08:55:30.565069 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:31.892750 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 query
08:55:32.734690 LLDP, length 197: Cisco IP Phone SPA504G
08:55:32.840776 IP6 fe80::921a:caff:fe80:3337 > ff02::1: ICMP6, router advertisement, length 56
08:55:33.570134 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:33.892857 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 query
08:55:34.569061 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:35.294281 IP6 fe80::921a:caff:fe80:3337.59002 > ff02::1:3.5355: UDP, length 90
08:55:35.295283 IP6 fe80::921a:caff:fe80:3337.59002 > ff02::1:3.5355: UDP, length 90
08:55:35.483794 IP6 fe80::921a:caff:fe80:3337.41980 > ff02::1:3.5355: UDP, length 90
08:55:35.484593 IP6 fe80::921a:caff:fe80:3337.41980 > ff02::1:3.5355: UDP, length 90
08:55:35.569065 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:35.841139 IP6 fe80::921a:caff:fe80:3337 > ff02::1: ICMP6, router advertisement, length 56
08:55:35.892964 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 reply
08:55:37.893073 90:1a:ca:80:33:3f > ff:ff:ff:ff:ff:ff, RRCP-0x23 reply
08:55:38.575236 ARP, Request who-has 192.168.10.1 tell 192.168.10.22, length 28
08:55:38.841177 IP6 fe80::921a:caff:fe80:3337 > ff02::1: ICMP6, router advertisement, length 56
^C
42 packets captured
42 packets received by filter
0 packets dropped by kernel
答案1
AFAIK,现在ubuntu盒子默认的网络管理模式是“NetworkManager”。配置文件位于
/etc/NetworkManager/NetworkManager.conf
以及后续目录,但需要大量阅读才能理解。当网络管理器运行时,桌面管理器的任务栏中会出现相应的小部件,您可以在其中重新配置您的配置。
尝试找到这个,并重新配置默认的网络连接,也许它根本没有启用。
那么应该不需要手动配置 /etc/network/interfaces 。
答案2
可以通过以下方式更改 enp15s0 的非托管和 ping 行为:
为此 - 在终端中: sudo nano /etc/NetworkManager/NetworkManager.conf
将管理 = false 行更改为管理 = true
保存、停止和启动网络管理器: sudo service network-manager restart
或者,您可以从 /etc/network/interfaces 中删除该接口。
备份当前的接口文件: sudo cp /etc/network/interfaces /etc/network_interfaces_backup
然后打开文件: sudo nano /etc/network/interfaces
删除该文件中的所有内容,然后复制并粘贴以下内容:auto lo iface lo inet Loopback
保存、停止和启动网络管理器: sudo service network-manager restart
答案3
去年夏天凌晨 3 点我发现 Ubuntu 16.04 ping 是一个 SUID 命令,只能由 root 超级用户调用
SUID(执行时设置所有者用户 ID)是赋予文件的一种特殊类型的文件权限。通常在 Linux/Unix 中,当程序运行时,它会继承登录用户的访问权限。 SUID 被定义为向用户授予临时权限,以使用文件所有者的权限(而不是运行它的用户的权限)运行程序/文件。简单来说,用户在执行文件/程序/命令时将获得文件所有者的权限以及所有者UID和GID。
普通用户没有打开套接字文件和打开端口的权限。因此,在此文件/命令上设置 SUID 位,以便执行此命令的任何人都将在执行此命令时获得所有者(Root 用户)权限。因此,当该命令开始执行时,它将继承 root 用户权限给该普通用户,并打开所需的套接字文件和端口。
这是我在2016年6月上旬解决上述问题的方法。
C# 应用程序必须在 Linux 上使用 mono 启动,因此您应该使用
Process.Start("mono", "full_path_of_your_exe");
编辑 2013-09-15 23:46 回复 2013-09-15 3:29
莱克斯·李 30.9k44666