Linux中路由器的架设

1、route 的常用的命令

  • route -n
    参考:Linux中的路由 route和traceroute
  • route add
    route add -net 192.168.80.0 netmask 255.255.255.0 gw 192.168.80.254
    route add -net 192.168.80.0 netmask 255.255.255.0 dev enp0s8
  • route del
    route del -net 192.168.80.0 netmask 255.255.255.0 gw 192.168.80.254
    route del -net 192.168.80.0 netmask 255.255.255.0 dev enp0s8

2、创建虚拟网卡

方法一:临时生效
[root@www ~]# ifconfig [device] [ IP ] netmask [netmask ip] [up|down]
[root@www ~]# ifconfig eth0:0 192.168.0.100 netmask 255.255.255.0 up

方法二:永久生效(推荐)
[root@www ~]# cd /etc/sysconfig/network-scripts
[root@www network-scripts]# vim ifcfg-eth0:0
DEVICE=eth0:0            <==相當重要!一定要與檔名相同的裝置代號!
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.100
NETMASK=255.255.255.

 

 

 

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注

您可以使用这些HTML标签和属性: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>