配置交换机的IP地址的命令
5.3.2.1 ip address
命令:ip address [ip-address] [mask] [secondary]
no ip address [[ip-address] [mask]] [secondary]
功能:设置交换机的指定vlan 接口的ip 地址及掩码;本命令的no 操作为删除该ip 地址配置。
参数:[ip-address]为ip 地址,点分十进制格式;[mask]为子网掩码,点分十进制格式;
[secondary]为表示配置的ip 地址为从ip 地址。
缺省情况:出厂时交换机无ip 地址。
命令模式:vlan 接口配置模式
使用指南:用户若要为交换机配置ip 地址,必须首先创建一个vlan 接口。
举例:设置vlan1 接口的ip 地址为10.1.128.1/24。
switch(config)#interface vlan 1
switch(config-if-vlan1)#ip address 10.1.128.1 255.255.255.0
switch(config-if-vlan1)#exit
switch(config)#
相关命令:ip bootp-client enable、ip dhcp-client enable
5.3.2.2 ip bootp-client enable
命令:ip bootp-client enable
no ip bootp-client enable
功能:使能交换机为bootp client,通过bootp 协商方式获取ip 地址及网关地址;本命令的no 操作为关闭bootp client 功能,并且释放以bootp 方式获取的地址和网关地址。
缺省情况:缺省关闭bootp client 功能。
命令模式:vlan 接口配置模式
使用指南:通过bootp 方式获取ip 地址和手工配置、dhcp 方式获取ip 地址是互斥的,不允许同时打开两种获取ip 地址的方式。
要获得ip 地址,网络上需要有dhcp server。
举例:通过bootp 方式获取ip 地址。
switch(config)#interface vlan 1
switch(config-if-vlan1)#ip bootp-client enable
switch(config-if-vlan1)#exit
switch(config)#
相关命令:ip address、ip dhcp-client enable
5.3.2.3 ip dhcp-client enable
命令:ip dhcp-client enable
no ip dhcp-client enable
功能:使能交换机为dhcp client,通过dhcp 协商方式获取ip 地址及网关地址;本命令的no 操作为关闭dhcp client 功能,并且释放以dhcp 方式获取的地址和网关地址。注意:要获得ip 地址,网络上需要有dhcp server。
缺省情况:缺省关闭dhcp client 功能。
命令模式:vlan 接口配置模式
使用指南:通过dhcp 方式获取ip 地址和手工配置、bootp 方式获取ip 地址是互斥的,不允许同时打开两种获取ip 地址的方式。
举例:通过dhcp 方式获取ip 地址。
switch(config)#interface vlan 1
switch(config-if-vlan1)#ip dhcp-client enable
switch(config-if-vlan1)#exit
switch(config)#
相关命令:ip address、ip bootp-client enable