gpt4 book ai didi

linux - linux中eth1上的静态IP地址

转载 作者:太空宇宙 更新时间:2023-11-04 10:18:57 25 4
gpt4 key购买 nike

我需要在启动后在 eth1 接口(interface)上设置一个静态 IP 地址。但是,在启动时,设备的 IP 地址始终与/etc/network/interfaces 中配置的 IP 地址不同。这是 beagle bone 上的 linux 操作系统。

##connman: WiFi
#
#connmanctl
#connmanctl> tether wifi off
#connmanctl> enable wifi
#connmanctl> scan wifi
#connmanctl> services
#connmanctl> agent on
#connmanctl> connect wifi_*_managed_psk
#connmanctl> quit

auto eth1
iface eth1 inet static
address 192.169.5.10
netmask 255.255.255.0

# Ethernet/RNDIS gadget (g_ether)
# Used by: /opt/scripts/boot/autoconfigure_usb0.sh
iface usb0 inet static
address 192.168.7.2
netmask 255.255.0.0
network 192.168.7.0
gateway 192.168.7.1

ifconfig输出如下

root@beaglebone:/opt/scripts/boot# ifconfig
eth0 Link encap:Ethernet HWaddr 04:a3:16:e1:5d:39
UP BROADCAST MULTICAST DYNAMIC 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
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:173

eth1 Link encap:Ethernet HWaddr 20:c9:d0:29:e0:88
inet addr:169.254.84.230 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::22c9:d0ff:fe29:e088/64 Scope:Link
UP BROADCAST RUNNING MULTICAST DYNAMIC MTU:1500 Metric:1
RX packets:56 errors:0 dropped:0 overruns:0 frame:0
TX packets:136 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:6708 (6.5 KiB) TX bytes:36844 (35.9 KiB)

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:236 errors:0 dropped:0 overruns:0 frame:0
TX packets:236 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1
RX bytes:18852 (18.4 KiB) TX bytes:18852 (18.4 KiB)

usb0 Link encap:Ethernet HWaddr 04:a3:16:e1:5d:3b
inet addr:192.168.7.2 Bcast:192.168.255.255 Mask:255.255.0.0
inet6 addr: fe80::6a3:16ff:fee1:5d3b/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:645 errors:0 dropped:0 overruns:0 frame:0
TX packets:492 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:74285 (72.5 KiB) TX bytes:98066 (95.7 KiB)

usb1 Link encap:Ethernet HWaddr 04:a3:16:e1:5d:3e
inet addr:192.168.6.2 Bcast:192.168.6.3 Mask:255.255.255.252
inet6 addr: fe80::6a3:16ff:fee1:5d3e/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:126 errors:0 dropped:0 overruns:0 frame:0
TX packets:61 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:39046 (38.1 KiB) TX bytes:13030 (12.7 KiB)

最佳答案

我认为您还需要添加网络地址、网关和DNS 设置,看here .然后使用以下命令重新启动服务器。

sudo service networking restart

sudo ifconfig eth1 down
sudo ifconfig eth1 up

关于linux - linux中eth1上的静态IP地址,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44731709/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com