简单的 eth0 配置不起作用

简单的 eth0 配置不起作用

我是一名网络人员,但我正尝试使用 Ubuntu 设备在 gns3 中设置 syslog 和 snmp 服务器:

Linux Toolbox-1 5.15.0-91-generic #101~20.04.1-Ubuntu SMP Thu Nov 16 14:22:28 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

我正在尝试配置 eth0 以连接到 gns3 中的一台路由器。我编辑了/etc/network/interfaces如下文件:

#
# This is a sample network config, please uncomment lines to configure the netwo
rk
#

# Uncomment this line to load custom interface files
# source /etc/network/interfaces.d/*

# Static config for eth0
auto eth0
iface eth0 inet static
        address 192.168.13.3
        netmask 255.255.255.0
        gateway 192.168.13.1
        up echo nameserver 192.168.0.1 > /etc/resolv.conf

# DHCP config for eth0
#auto eth0
#iface eth0 inet dhcp
#       hostname Toolbox-1

此后,我使用重新启动了界面ifconfig eth0 down && ifconfig eth0 up。但是 eth0 似乎没有从文件中获取 IP 地址:

root@Toolbox-1:/etc/network# ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet6 fe80::fc97:d2ff:fe35:b2c9  prefixlen 64  scopeid 0x20<link>
        ether fe:97:d2:35:b2:c9  txqueuelen 1000  (Ethernet)
        RX packets 152  bytes 12845 (12.8 KB)
        RX errors 0  dropped 50  overruns 0  frame 0
        TX packets 23  bytes 1802 (1.8 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

相关内容