Ubuntu网络配置与管理

        (1)查看网卡信息:ifconfig
        默认下,Ubuntu系统中没有ifconfig命令,需要进行安装,安装命令为:sudo apt-get install net-tools
        ifconfig:该命令会显示网卡的信息。

# 查看网卡信息
fu@fu-virtual-machine:~/桌面$ ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.159.128  netmask 255.255.255.0  broadcast 192.168.159.255
        inet6 fe80::da4d:c9e6:39fc:8287  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:b0:35:58  txqueuelen 1000  (以太网)
        RX packets 468203  bytes 653390045 (653.3 MB)
        RX errors 1129  dropped 4  overruns 0  frame 0
        TX packets 171357  bytes 14191036 (14.1 MB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
        device interrupt 19  base 0x2000  

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  (本地环回)
        RX packets 7504  bytes 777975 (777.9 KB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 7504  bytes 777975 (777.9 KB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

        (2)查看端口状态:netstat
        netstat -a:查看所有处于活动状态的端口信息。

# 将使用"netstat -a"获得接口信息写入"info.txt"文件
fu@fu-virtual-machine:~$ netstat -a > info.txt
# 查看"info.txt"文件的前三行
fu@fu-virtual-machine:~$ head -n 3 info.txt
激活Internet连接 (服务器和已建立连接的)
Proto Recv-Q Send-Q Local Address           Foreign Address         State      
tcp        0      0 localhost:domain        0.0.0.0:*               LISTEN 

Guess you like

Origin blog.csdn.net/D___H/article/details/121101072