有没有一种优雅的方式来testingBASH脚本中的IP地址? 我可以做ifconfig和使用sed / awk来缩小IP,但我认为有一个更简单的解决scheme。 我的应用程序基本上是使用SSH / SCP脚本,当我在我的内部网,而我没有。 所以,我想要这种types的stream程 if IP=192.168.1.1 then do this else then do that
我想创build几个别名到eth0,但有地址分配的DHCP而不是被设置为静态IP的。 这甚至有可能吗? 我见过的所有例子都使用下面的命令分配一个静态IP: ifconfig eth0:0 192.168.1.11 up 谢谢
为了在Linux中执行ifconfig并更改IP和VIP,是否需要root权限? 或者也可以通过非root帐户来完成此操作?
首先,这里是我的/ etc / network / interfaces auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 10.10.4.142 netmask 255.255.255.0 gateway 10.10.4.1 auto eth1 iface eth1 inet static address 10.10.4.138 netmask 255.255.255.0 gateway 10.10.4.1 在启动时,eth1和eth0都可以访问和使用。 我closures了我的eth1接口 ifdown eth1 我的ifconfig不显示我的eth1接口。 但是,当我尝试ping 10.10.4.138(连接到我的eth1的IP地址),它ping! 我不认为这应该是正常的行为。 如果是这样,你能解释我为什么吗? 为什么我们可以ping一个“失败”的界面?
我试图设置一个静态IP在我的Debian 8.1(在VirtualBox),所以我编辑了/ etc / network / interface文件: # The loopback network interface auto lo iface lo inet loopback auto eth0 iface eth0 inet static address 192.168.1.51 netmask 255.255.255.0 gateway 192.168.1.1 broadcast 192.168.1.255 这个configuration看起来是正确的(我也试过没有'auto eth0'),这个ip还没有在networking中使用。 但是,当我检查与ifconfig,eth0不会出现,显然是在我的configuration错误。 ifconfig无界面编辑(正常): eth0 Link encap:Ethernet HWaddr 08:00:27:4a:58:ae inet addr:192.168.1.43 Bcast:192.168.1.255 Mask:255.255.255.0 inet6 addr: fe80::a00:27ff:fe4a:58ae/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 […]
我有一个FreeBSD 11系统,其中我得到ifconfig命令的以下输出 # ifconfig lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384 options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6> inet6 ::1 prefixlen 128 inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 inet 127.0.0.1 netmask 0xff000000 nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL> groups: lo xn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500 options=503<RXCSUM,TXCSUM,TSO4,LRO> ether 0e:c2:a2:36:c1:b4 inet 10.0.0.71 netmask 0xffffff00 broadcast 10.0.0.255 nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL> media: Ethernet manual status: active 这里有两个疑问: 为什么我没有获得RX,TX字节和数据包计数就像我得到的旧的FreeBSD / ubuntu系统? […]
Check_MK给我发了一封电子邮件,内容如下: ***** Nagios ***** Notification Type: PROBLEM Service: Interface 5 Host: foo Address: xyzt State: CRITICAL Date/Time: Fri May 3 10:02:40 ICT 2013 Additional Info: CRIT – [tunl0] (up) speed unknown, in: 3.39MB/s, out: 0.00B/s, out-errors: 100.00%(!!) = 0.1 运行ifconfig ,我得到: tunl0 Link encap:IPIP Tunnel HWaddr inet addr:xyzt Mask:255.255.255.255 UP RUNNING NOARP MTU:1480 Metric:1 RX […]
重新启动一个无头CentOS 6.3机器后,它失去了出站互联网连接,即我仍然可以通过SSH连接到服务器( ssh root@**.126.18.56 ),但ping google.com等东西给google.com: unknown host和yum list some_package给出了很多networking错误。 这是ifconfig给出的: eth0 Link encap:Ethernet HWaddr 00:25:90:78:2D:5D inet addr:**.126.18.56 Bcast:**.126.18.255 Mask:255.255.255.0 inet6 addr: fe80::225:90ff:fe78:2d5d/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:75594 errors:0 dropped:0 overruns:0 frame:0 TX packets:787 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:7074741 (6.7 MiB) TX bytes:144391 (141.0 KiB) Interrupt:20 Memory:f7a00000-f7a20000 eth1 […]
我想获得所有活动networking接口(例如eth0,wlan0)的列表。 我假设我将不得不parsingifconfig的输出,但是各种操作系统的格式是不同的。 有没有人有一个可移植的方式来获取这些信息,因此可以在大多数unices(linux,* bsd,mac)上使用。
如何列出为给定的networking接口卡创build的所有虚拟networking? 例如我已经添加了这样的虚拟networking, ifconfig eth0:0 inet6 add ::123/64 它的响应很好。 而且我知道我可以使用该networking,因为我添加了它。 但如果我不是那个加了它的人,我怎么会发现它存在?