装置镜像与virt-manager
的网口配置
应用virt-manager
装置实现交换机之后,在显示虚构硬件详情的菜单项上面配置虚构网口配置为虚构网络*
路由到某个网口(默认的是虚构网络default
: NAT
, 须要自行去创立一个网口,配置网口的取值范畴),设施型号抉择e1000
具体操作参考在KVM中
通过导入qcow2
镜像形式装置虚拟机(图形界面)
配置交换机网口
进入特权模式,这边配置的网口为GigabitEthernet 0/0
,ip
地址与掩码为192.168.1.222/24
Switch> enable
查看以后网口配置, 个别会呈现一个Gi...0/0
的网口,抉择配置这个,如果没有看到这个网口,须要去重新配置virt-manager
的对应虚拟机网口
Switch# show ip interface GigabitEthernet0/0 is up, line protocol is up....
进入全局配置模式
Switch# configure terminal
开始配置Gi0/0
网口
Switch(config)#interface GigabitEthernet 0/0
如果曾经有配置,想批改配置,须要重置一下该网口配置
Switch(config-if)# no ip address
在三层交换机下面,能够把二层接口改为三层接口,把该网口配置为等于一个路由器上的接口
Switch(config-if)#no switchport
配置网口IP
和掩码
Switch(config-if)#ip address 192.168.1.222 255.255.255.0
确保网卡状态是up
, 如果要down
网卡,间接shutdown
即可
Switch(config-if)#no shutdown
退出网口配置模式
Switch(config-if)#end
查看网口配置信息,网口状态是up
并且ip
,掩码等信息都有
Switch#show ip interface GigabitEthernet0/0 is up, line protocol is up Internet address is 192.168.1.222/24 Broadcast address is 255.255.255.255 .......
要将配置的设置保留到启动配置文件,保障下次重启的时候网口配置还在,在弹出对话问题行输出startup-config
Switch#copy running-config startup-configDestination filename [startup-config]? startup-configBuilding configuration...Compressed configuration from 2758 bytes to 1360 bytes[OK]
配置实现之后能够在本人的pc
机器下面去ping
交换机网口的IP
,如果网络不通的话须要重启一下交换机,间接在virt-manager
控制台那边点击按钮强制关机重启就行
配置开启snmp
进入特权模式,配置开启snmp v2
,community
认证参数是public
Switch> enable
查看snmp
协定是否开启
Switch# show snmp
进入全局配置模式
Switch# configure terminal
设置只读字符串,public
为community
认证参数,ro
为只读,rw
为读写
Switch<config># snmp-server community public ro
退出配置模式
Switch<config># end
查看snmp
状态
Switch#show snmp Chassis: 9NA6LLEED7N1758 SNMP packets input 0 Bad SNMP version errors 0 Unknown community name 0 Illegal operation for community name supplied 0 Encoding errors 1757 Number of requested variables 0 Number of altered variables 0 Get-request PDUs 1757 Get-next PDUs 0 Set-request PDUs 0 Input queue packet drops (Maximum queue size 1000)1758 SNMP packets output 0 Too big errors (Maximum packet size 1500) 0 No such name errors 0 Bad values errors 0 General errors 1757 Response PDUs 0 Trap PDUsSNMP global trap: disabledSNMP logging: disabled
要将配置的设置保留到启动配置文件,保障下次重启的时候网口配置还在,在弹出对话问题行输出startup-config
Switch#copy running-config startup-configDestination filename [startup-config]? startup-configBuilding configuration...Compressed configuration from 2758 bytes to 1360 bytes[OK]
重启机器之后验证网口配置和snmp
配置是否还在
Switch>enableSwitch#show ip interfaceSwitch#show snmp
后果验证
在本人的pc
机器下面进行配置后果验证
ping
验证
$ ping 192.168.1.222PING 192.168.1.222 (192.168.1.222) 56(84) bytes of data.64 bytes from 192.168.1.222: icmp_seq=1 ttl=255 time=0.999 ms
udp
端口扫描验证
$ sudo nmap -sU 192.168.1.222 -p 161Starting Nmap 7.80 ( https://nmap.org ) at 2023-02-12 18:45 CSTNmap scan report for 192.168.1.222Host is up (0.0014s latency).PORT STATE SERVICE161/udp open snmpMAC Address: 52:54:00:0E:67:57 (QEMU virtual NIC)Nmap done: 1 IP address (1 host up) scanned in 2.36 seconds
snmp
申请验证(留神,该查问会产生大量输入)
$ snmpwalk -v 2c -c public 192.168.1.222 .1# 输入中会蕴含cisco和switch等关键字...SNMPv2-MIB::sysDescr.0 = STRING: Cisco IOS Software, vios_l2 Software (vios_l2-ADVENTERPRISEK9-M), Version 15.2(CML_NIGHTLY_20190423)FLO_DSGS7, EARLY DEPLOYMENT DEVELOPMENT BUILD, synced to V152_6_0_81_ETechnical Support: http://www.cisco.com/techsupportCopyright (c) 1986-2019 by CiSNMPv2-MIB::sysObjectID.0 = OID: SNMPv2-SMI::enterprises.9.1.1227DISMAN-EVENT-MIB::sysUpTimeInstance = Timeticks: (120690) 0:20:06.90SNMPv2-MIB::sysContact.0 = STRING: SNMPv2-MIB::sysName.0 = STRING: SwitchSNMPv2-MIB::sysLocation.0 = STRING: SNMPv2-MIB::sysServices.0 = INTEGER: 78...
参考浏览
在KVM中
通过导入qcow2
镜像形式装置虚拟机(图形界面)
Linux
应用virt-manager
生成qcow2
零碎镜像并启动虚拟机
cli
模式上面的cisco
的snmp
配置
cisco
在cli
模式上面配置第 3 层交换机上的 InterVLAN
路由
cisco
在cli
模式上面配置交换机IP
地址