最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

centos7.6批量增加修改刪除虛擬網(wǎng)卡操作介紹

 更新時間:2021年12月13日 14:48:05   作者:藍眼淚007  
大家好,本篇文章主要講的是centos7.6批量增加修改刪除虛擬網(wǎng)卡操作介紹,感興趣的同學趕快來看一看吧,對你有幫助的話記得收藏一下

1 確認內(nèi)核是否有tun模塊

modinfo tun
modprobe tun
lsmod | grep tun

2 安裝tunctl軟件

yum install tunctl -y
vim /etc/yum.repos.d/nux-misc.repo
[nux-misc]
name=Nux Misc
baseurl=http://li.nux.ro/download/nux/misc/el7/x86_64/
enabled=0
gpgcheck=1
gpgkey=http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro

?

yum --enablerepo=nux-misc install tunctl

軟件名稱:tunctl-1.5-12.el7.nux.x86_64

3 添加多個ip并綁定到網(wǎng)卡 ?

cd /etc/sysconfig/network-scripts
cp ifcfg-lo ifcfg-lo:1 
vim ifcfg-lo:1 

DEVICE=lo:1?
ONBOOT=yes?
BOOTPROTO=static?
IPADDR=新增IP?
NETMASK=子網(wǎng)掩碼?
GATEWAY=網(wǎng)關地址?

systemctl restart network

4 批量添加虛擬網(wǎng)卡

tunctl -t tap0 -u root  

tap0 是虛擬網(wǎng)卡名字

ifconfig tap0 172.168.1.1 netmask 255.255.255.0 promisc

172.168.1.1 是ip地址

ip tuntap add tap1 mode tun
tunctl -t tap0 -u root                     
ifconfig tap0 172.168.1.1 netmask 255.255.255.0 promisc
ip tuntap add tap1 mode tap
ifconfig tap1 10.0.0.1/16
ip tuntap add tap2 mode tap
ifconfig tap2 10.0.0.1/17
ip tuntap add tap3 mode tap
ifconfig tap3 10.0.0.1/18
ip tuntap add tap4 mode tap
ifconfig tap4 10.0.0.1/19
ip tuntap add tap5 mode tap
ifconfig tap5 10.0.0.1/20
ip tuntap add tap6 mode tap
ifconfig tap6 10.0.0.1/21
ip tuntap add tap7 mode tap
ifconfig tap7 10.0.0.1/22
ip tuntap add tap8 mode tap
ifconfig tap8 10.0.0.1/23
ip tuntap add tap9 mode tap
ifconfig tap9 10.0.0.1/24

sh addVirnet.sh?

#!/bin/bash
#
i=0
n=0
while [ $n -le 10 ];do
i=$(( $i + $n ))
n=$(( $n + 1 ))
ip tuntap add tap$n mode tap
done
echo $i 

5 批量修改虛擬網(wǎng)卡

ifconfig tap0 192.168.130.17  netmask 255.255.255.0 promisc 
ifconfig tap1 192.168.130.18  netmask 255.255.255.0 promisc 
ifconfig tap2 192.168.130.19  netmask 255.255.255.0 promisc 
ifconfig tap3 192.168.130.20  netmask 255.255.255.0 promisc 
ifconfig tap4 192.168.130.21  netmask 255.255.255.0 promisc 
ifconfig tap5 192.168.130.23  netmask 255.255.255.0 promisc 
ifconfig tap6 192.168.130.24  netmask 255.255.255.0 promisc
ifconfig tap7 192.168.130.25  netmask 255.255.255.0 promisc 
ifconfig tap8 192.168.130.28  netmask 255.255.255.0 promisc 
ifconfig tap9 192.168.130.30  netmask 255.255.255.0 promisc

6 批量刪除虛擬網(wǎng)卡

tunctl -d tap0
tunctl -d tap1
tunctl -d tap2
tunctl -d tap3
tunctl -d tap4
tunctl -d tap5
tunctl -d tap6
tunctl -d tap7
tunctl -d tap8
tunctl -d tap9

sh deleteVirnet.sh

#!/bin/bash
#
i=0
n=0
while [ $n -le 10 ];do
i=$(( $i + $n ))
n=$(( $n + 1 ))
tunctl -d tap$n
done
echo $i 

其他命令

tunctl
brctl show

brctl addbr br-zhai
brctl addif br-zhai tap0
brctl addif br-zhai tap1
ifconfig -a
brctl show
ifconfig br-zhai 192.168.9.1 up
ifconfig br-zhai
ifconfig -a
brctl show
brctl showmacs br-zhai
ifconfig tap0 promisc
ifconfig

開啟自動啟動虛擬網(wǎng)卡腳本?

vim /etc/init.d/config_tap 
  #!/bin/bash
  #
  # config_tap          Start up the tun/tap virtual nic
  #
  # chkconfig: 2345 55 25
  USER="root"
  TAP_NETWORK="192.168.130.10"
  TAP_DEV_NUM=0
  DESC="TAP config"
  do_start() {
    if [ ! -x /usr/sbin/tunctl ]; then
      echo "/usr/sbin/tunctl was NOT found!"
      exit 1
    fi
    tunctl -t tap$TAP_DEV_NUM -u root
    ifconfig tap$TAP_DEV_NUM ${TAP_NETWORK}  netmask 255.255.255.0 promisc
    ifconfig tap$TAP_DEV_NUM
  }
  do_stop() {
    ifconfig tap$TAP_DEV_NUM down 
  }
  do_restart() {
    do_stop
    do_start
  }
  check_status() {
    ifconfig tap$TAP_DEV_NUM 
  }
  case $1 in 
    start)    do_start;;
    stop)     do_stop;;
    restart)  do_restart;;
    status)
              echo "Status of $DESC: "
              check_status
              exit "$?"
              ;;
    *)
      echo "Usage: $0 {start|stop|restart|status}"
      exit 1 
  esac
n=0
while [ $n -le 8 ];do
n=$(( $n + 1 ))
ip tuntap add tap$n mode tap
done
echo $i 
ifconfig tap0 192.168.1.110  netmask 255.255.255.0 promisc 
ifconfig tap1 192.168.1.111  netmask 255.255.255.0 promisc 
ifconfig tap2 192.168.1.112  netmask 255.255.255.0 promisc 
ifconfig tap3 192.168.1.113  netmask 255.255.255.0 promisc 
ifconfig tap4 192.168.1.114  netmask 255.255.255.0 promisc 
ifconfig tap5 192.168.1.115  netmask 255.255.255.0 promisc 
ifconfig tap6 192.168.1.116  netmask 255.255.255.0 promisc 
ifconfig tap7 192.168.1.117  netmask 255.255.255.0 promisc 
ifconfig tap8 192.168.1.118  netmask 255.255.255.0 promisc 
ifconfig tap9 192.168.1.119  netmask 255.255.255.0 promisc 
chkconfig --add config_tap 
chkconfig --level 345 config_tap on
service config_tap start 

到此這篇關于centos7.6批量增加修改刪除虛擬網(wǎng)卡操作介紹的文章就介紹到這了,更多相關centos7.6增加修改刪除網(wǎng)卡內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持腳本之家!

相關文章

  • Apache 新站點目錄配置 SELinux 的方法

    Apache 新站點目錄配置 SELinux 的方法

    本文詳細介紹了如何使用SELinux保護Apache新站點目錄,包括確定默認上下文、創(chuàng)建和設置新目錄的上下文、允許網(wǎng)絡連接以及驗證配置,感興趣的朋友跟隨小編一起看看吧
    2024-11-11
  • 紅帽RHEL8和7的區(qū)別對比分享(Centos8與7參照redhat)

    紅帽RHEL8和7的區(qū)別對比分享(Centos8與7參照redhat)

    這篇文章主要介紹了紅帽RHEL8和7有什么區(qū)別(Centos8與7參照redhat),包括紅帽RHEL8和RHEL7功能區(qū)別對比和RHEL8額外新功能新特性,對紅帽RHEL8和7相關知識感興趣的朋友跟隨小編一起看看吧
    2023-01-01
  • Linux硬鏈接與軟鏈接原理及用法解析

    Linux硬鏈接與軟鏈接原理及用法解析

    這篇文章主要介紹了Linux硬鏈接與軟鏈接原理及用法解析,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2020-05-05
  • 如何在Linux命令行與其他用戶通信

    如何在Linux命令行與其他用戶通信

    這篇文章主要介紹了如何在Linux命令行與其他用戶通信,文中通過示例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友可以參考下
    2020-09-09
  • Centos7.3服務器搭建LNMP環(huán)境的方法

    Centos7.3服務器搭建LNMP環(huán)境的方法

    這篇文章主要介紹了Centos7.3服務器搭建LNMP環(huán)境的方法,結合實例形式分析了Centos7.3搭建LNMP環(huán)境的相關步驟、命令、使用方法及注意事項,需要的朋友可以參考下
    2018-04-04
  • 搭建阿里云ecs服務器之安裝圖形化界面的方法

    搭建阿里云ecs服務器之安裝圖形化界面的方法

    這篇文章主要介紹了搭建阿里云ecs服務器之安裝圖形化界面的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-08-08
  • 輕松搞定VIM高亮NGINX配置文件的方法

    輕松搞定VIM高亮NGINX配置文件的方法

    在使用vim在寫東西的時候,如果有語法高亮顯示就會方便很多,之前給大家介紹了很多關于vim高亮的文章,那這篇文章主要給大家介紹了如何輕松搞定VIM高亮NGINX配置文件的方法,需要的朋友可以參考借鑒,下面來一起看看吧。
    2017-10-10
  • Linux服務器間文件實時同步的實現(xiàn)

    Linux服務器間文件實時同步的實現(xiàn)

    這篇文章主要介紹了Linux服務器間文件實時同步的實現(xiàn),小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2018-11-11
  • linux expect實現(xiàn)登陸遠程主機并執(zhí)行命令示例代碼

    linux expect實現(xiàn)登陸遠程主機并執(zhí)行命令示例代碼

    這篇文章主要給大家介紹了linux expect實現(xiàn)登陸遠程主機并執(zhí)行命令的相關資料,文中給出了詳細的示例代碼供大家參考學習,對大家具有一定的參考學習價值,需要的朋友們下面來一起看看吧。
    2017-06-06
  • linux下安裝nodejs及npm的方法

    linux下安裝nodejs及npm的方法

    本篇文章主要介紹了linux下安裝nodejs及npm的方法,小編覺得挺不錯的,現(xiàn)在分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2017-06-06

最新評論

安吉县| 交口县| 区。| 昭苏县| 唐山市| 广宗县| 宣威市| 凌源市| 金坛市| 静安区| 秭归县| 长白| 平陆县| 本溪市| 万年县| 达孜县| 织金县| 将乐县| 文登市| 台山市| 庆云县| 永定县| 平谷区| 元氏县| 兴安盟| 敖汉旗| 鹰潭市| 裕民县| 朝阳县| 繁峙县| 奇台县| 朝阳区| 东光县| 绥中县| 偃师市| 方山县| 扬州市| 成安县| 天津市| 于田县| 沙田区|