linux 配置网卡

if config 配置网卡

ifconfig :显示所有网卡信息

ifconfig eth0 : 查看网卡eth0的信息

ifconfig eth0 down :禁用eth0

if config eth0 up : 激活eth0

if config eth0 192.168.1.101 : 配置网卡eth0的IP地址

网络设置:

sudo route add default gw 192.168.1.1  : 添加网关

/etc/network/interfaces restart  : 重启网络服务

配置DNS:

sudo vi /etc/resolv.conf :

nameserver 202.96.134.133

nameserver 202.96.128.68

nameserver 202.96.128.68

配置静态IP:

sudo vi /etc/network/interfaces :

iface eth0 inet static  # 配置eth0接口为静态地址

address 192.168.1.10

gateway 192.168.1.254

netmask 255.255.255.0

network 192.168.1.0

broadcast 192.168.1.255

抓包:

tcpdump -i wlan0

返回上一次的路径 :

cd -

 

原文地址:https://www.cnblogs.com/cjj-zyj/p/9914935.html