首页 > 其他 > 详细

10-0 静态路由

时间:2021-05-04 10:05:45      阅读:19      评论:0      收藏:0      [点我收藏+]

静态路由

技术分享图片

新增vmnet10网段

技术分享图片

注明:

? 1、A:centos7 R1、R2:centos8 B:ubuntu

A

hostnamectl set-hostname a.org
exit
ip route 
ip route del default via 10.0.0.200 dev eth0 proto static metric 100
ip route add default via 10.0.0.200 dev eth0 proto static metric 100

R1

vim /etc/sysconfig/network-scripts/ifcfg-eth0
	DEVICE=eth0
	NAME=eth0
	BOOTPROTO=static
	IPADDR=10.0.0.200
	PREFIX=24
	ONBOOT=yes
vim /etc/sysconfig/network-scripts/ifcfg-eth1
	DEVICE=eth1
	NAME=eth1
	BOOTPROTO=static
	IPADDR=192.168.10.200
	PREFIX=24
	ONBOOT=yes

nmcli connection reload
nmcli connection up eth0
nmcli connection up eth1

echo 1 > proc/sys/net/ipv4/ip_forward

R2

vim /etc/sysconfig/network-scripts/ifcfg-eth0
	DEVICE=eth0
	NAME=eth0
	BOOTPROTO=static
	IPADDR=192.168.10.201
	PREFIX=24
	ONBOOT=yes
vim /etc/sysconfig/network-scripts/ifcfg-eth1
	DEVICE=eth1
	NAME=eth1
	BOOTPROTO=static
	IPADDR=172.16.0.200
	PREFIX=24
	ONBOOT=yes

nmcli connection reload
nmcli connection up eth0
nmcli connection up eth1

echo 1 > proc/sys/net/ipv4/ip_forward

B

vim /etc/netplan/01-netcfg.yaml
	network:
	  version: 2
	  renderer:
	  ethernets:
	    eth0:
	      addresses:
	      - 172.16.0.100/24
	      gateway4: 172.16.0.200

netplan apply

10-0 静态路由

原文:https://www.cnblogs.com/shijianing/p/14728776.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!