1 Überprüfen Sie, ob der Kernel ein Tun-Modul hat modinfo tun modprobe tun grep tun 2 Installieren Sie die Tunctl-Software yum installiere tunctl -y vim /etc/yum.repos.d/nux-misc.repo [Nux-Verschiedenes] Name=Nux Sonstiges Base-URL = http://li.nux.ro/download/nux/misc/el7/x86_64/ aktiviert=0 gpgcheck=1 gpgkey=http://li.nux.ro/download/nux/RPM-GPG-KEY-nux.ro yum --enablerepo=nux-misc installiere tunctl Softwarename: tunctl-1.5-12.el7.nux.x86_64 3 Fügen Sie mehrere IPs hinzu und binden Sie sie an die Netzwerkkarte cd /etc/sysconfig/netzwerkskripte cp ifcfg-lo ifcfg-lo:1 vim ifcfg-lo:1 GERÄT=lo:1 systemctl restart network 4 Virtuelle Netzwerkkarten stapelweise hinzufügen tunctl -t tap0 -u root tap0 ist der Name der virtuellen Netzwerkkarte ifconfig tap0 172.168.1.1 Netzmaske 255.255.255.0 promisc 172.168.1.1 ist die IP-Adresse ip tuntap hinzufügen tap1 modus tun tunctl -t tap0 -u root ifconfig tap0 172.168.1.1 Netzmaske 255.255.255.0 promisc ip tuntap hinzufügen tap1 modus tap ifconfig tap1 10.0.0.1/16 ip tuntap hinzufügen tap2 modus tap ifconfig tap2 10.0.0.1/17 ip tuntap hinzufügen tap3 modus tap ifconfig tap3 10.0.0.1/18 ip tuntap hinzufügen tap4 modus tap ifconfig tap4 10.0.0.1/19 ip tuntap hinzufügen tap5 modus tap ifconfig tap5 10.0.0.1/20 ip tuntap hinzufügen tap6 modus tap ifconfig tap6 10.0.0.1/21 ip tuntap hinzufügen tap7 modus tap ifconfig tap7 10.0.0.1/22 ip tuntap hinzufügen tap8 modus tap ifconfig tap8 10.0.0.1/23 ip tuntap hinzufügen tap9 modus tap ifconfig tap9 10.0.0.1/24 sh addVirnet.sh #!/bin/bash # ich = 0 n = 0 während [ $n -le 10 ];machen i=$(( $i + $n )) n=$(( $n + 1 )) ip tuntap hinzufügen tap$n modus tap Erledigt echo $i 5 Stapelmodifizierung virtueller Netzwerkkarten ifconfig tap0 192.168.130.17 Netzmaske 255.255.255.0 Promisc ifconfig tap1 192.168.130.18 Netzmaske 255.255.255.0 Promisc ifconfig tap2 192.168.130.19 Netzmaske 255.255.255.0 Promisc ifconfig tap3 192.168.130.20 Netzmaske 255.255.255.0 Promisc ifconfig tap4 192.168.130.21 Netzmaske 255.255.255.0 promisc ifconfig tap5 192.168.130.23 Netzmaske 255.255.255.0 Promisc ifconfig tap6 192.168.130.24 Netzmaske 255.255.255.0 Promisc ifconfig tap7 192.168.130.25 Netzmaske 255.255.255.0 Promisc ifconfig tap8 192.168.130.28 Netzmaske 255.255.255.0 promisc ifconfig tap9 192.168.130.30 Netzmaske 255.255.255.0 Promisc 6 Virtuelle Netzwerkkarten stapelweise löschen 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 löscheVirnet.sh #!/bin/bash # ich = 0 n = 0 während [ $n -le 10 ];machen i=$(( $i + $n )) n=$(( $n + 1 )) tunctl -d tippen$n Erledigt echo $i Andere Befehle tunctl brctl addbr br-zhai brctl addif br-zhai tap0 brctl addif br-zhai tap1 ifconfig -a brctl anzeigen ifconfig br-zhai 192.168.9.1 up ifconfig br-zhai ifconfig -a brctl anzeigen brctl Showmacs br-zhai ifconfig tap0 promisc ifconfig Automatischen Start des Skripts für virtuelle Netzwerkkarten aktivieren vim /etc/init.d/config_tap #!/bin/bash # # config_tap Starten Sie die virtuelle Netzwerkkarte tun/tap # # chkconfig: 2345 55 25 USER="Wurzel" TAP_NETWORK="192.168.130.10" TAP_DEV_NUM=0 DESC="TAP-Konfiguration" starte_starten() { wenn [ ! -x /usr/sbin/tunctl ]; dann echo "/usr/sbin/tunctl wurde NICHT gefunden!" Ausfahrt 1 fi tunctl -t tap$TAP_DEV_NUM -u root ifconfig tap$TAP_DEV_NUM ${TAP_NETWORK} Netzmaske 255.255.255.0 promisc ifconfig tippen$TAP_DEV_NUM } mache_stopp() { ifconfig tap$TAP_DEV_NUM nach unten } starte_neu. mach_stopp starte_starten } check_status() { ifconfig tippen$TAP_DEV_NUM } Fall $1 in starten) do_start;; stopp) do_stop;; Neustart) do_restart;; Status) echo "Status von $DESC: " check_status beenden "$?" ;; *) echo "Verwendung: $0 {start|stop|restart|status}" Ausfahrt 1 esac n = 0 während [ $n -le 8 ];machen n=$(( $n + 1 )) ip tuntap hinzufügen tap$n modus tap Erledigt echo $i ifconfig tap0 192.168.1.110 Netzmaske 255.255.255.0 promisc ifconfig tap1 192.168.1.111 Netzmaske 255.255.255.0 promisc ifconfig tap2 192.168.1.112 Netzmaske 255.255.255.0 promisc ifconfig tap3 192.168.1.113 Netzmaske 255.255.255.0 Promisc ifconfig tap4 192.168.1.114 Netzmaske 255.255.255.0 promisc ifconfig tap5 192.168.1.115 Netzmaske 255.255.255.0 promisc ifconfig tap6 192.168.1.116 Netzmaske 255.255.255.0 promisc ifconfig tap7 192.168.1.117 Netzmaske 255.255.255.0 promisc ifconfig tap8 192.168.1.118 Netzmaske 255.255.255.0 promisc ifconfig tap9 192.168.1.119 Netzmaske 255.255.255.0 promisc chkconfig --add config_tap chkconfig --level 345 config_tap ein Dienst config_tap starten Dies ist das Ende dieses Artikels über das Hinzufügen, Ändern und Löschen virtueller Netzwerkkarten in Stapeln in centos7.6. Weitere relevante Inhalte zum Hinzufügen, Ändern und Löschen von Netzwerkkarten in centos7.6 finden Sie in früheren Artikeln auf 123WORDPRESS.COM oder in den verwandten Artikeln weiter unten. Ich hoffe, dass jeder 123WORDPRESS.COM in Zukunft unterstützen wird! Das könnte Sie auch interessieren:
|
<<: Schaltflächen und Dropdown-Menüs für Studiennotizen in Bootstrap 3.0
>>: Übung zum dynamischen Erstellen von Dialogen entsprechend dem Dateinamen in vue+el-element
Konzept MMM (Master-Master-Replikationsmanager fü...
Die meisten Websites haben heutzutage lange Seite...
Vorwort Der vom Blogger verwendete Server wurde v...
Inhaltsverzeichnis 0x0 Einführung 0x1 Installatio...
Die Installation von mysql-5.7.17 wird weiter unt...
Schluss mit Unsinn, Postleitzahl HTML-Teil <di...
Vorwort: Die vollständige Kapselung eines Funktio...
Inhaltsverzeichnis 1. React Hooks vs. reine Funkt...
1. Umwelt VS 2019 16.9.0 Vorschau 1.0 .NET SDK 5....
Inhaltsverzeichnis Virtueller DOM Was ist virtuel...
Inhaltsverzeichnis Überblick 1. Kompositions-API ...
Vorwort Relationale Datenbanken werden eher zu Sy...
1. Offizielle Einführung grep ist ein häufig verw...
Als Backend-Programmierer haben Sie an vielen Ste...
<br />Dieses Tag kann eine horizontale Linie...