暂时设置ip、vlan、路由
ip:
ifconfig eno0 192.168.0.2/24 broadcast 192.168.0.255 up
vlan:
为eth0添加Vlan
ip link add link eth0 name eth0.5 type vlan id 5
ip -d link show eth0.5
分配IP并设置启动:
ip addr add 192.168.1.200/24 brd 192.168.1.255 dev eth0.5
ip link set dev eth0.5 up
删除:
ip link set dev eth0.5 down
ip link delete eth0.5
路由
- 临时开启路由功能:
echo 1 > /proc/sys/net/ipv4/ip_forward
或者
sysctl -w net.ipv4.ip_forward=1
- 永久开启路由功能
vim /etc/sysctl.conf
net.ipv4.ip_forward = 1
网友评论