思科模拟器vlan配置常用代码
时间: 2024-02-12 21:00:46 浏览: 69
以下是思科模拟器中常用的VLAN配置代码:
1. 创建交换机:
```shell
enable
configure terminal
hostname Switch1
```
2. 连通交换机:
```shell
interface GigabitEthernet0/1
switchport mode trunk
```
3. 创建主机:
```shell
interface GigabitEthernet0/2
switchport mode access
switchport access vlan 2
```
4. 连通主机与交换机:
```shell
interface GigabitEthernet0/3
switchport mode access
switchport access vlan 2
```
5. 配置主机IP地址:
```shell
interface Vlan2
ip address 192.168.1.2 255.255.255.0
no shutdown
```
6. 配置交换机地址:
```shell
interface Vlan3
ip address 192.168.2.1 255.255.255.0
no shutdown
```
7. 配置f0/3为Trunk模式:
```shell
interface FastEthernet0/3
switchport mode trunk
```
8. 配置另一台交换机:
```shell
enable
configure terminal
hostname Switch2
```
9. 创建VLAN2:
```shell
vlan 2
name VLAN2
```
10. 创建VLAN3:
```shell
vlan 3
name VLAN3
```
11. 配置f0/3为Trunk模式:
```shell
interface FastEthernet0/3
switchport mode trunk
```
12. 测试网络是否连通:
```shell
ping 192.168.1.2
ping 192.168.2.1
```