ip default-gateway
当路由器上的ip routing无效时,使用它指定默认路由,用于RXBoot模式(no ip routing)下安装IOS等。或者关闭ip routing 让路由器当主机用,此时需要配置默认网关。另外此命令常用于二层交换机上,因为在二层交换机上没有第三层路由表项。
1、静态路由
Current configuration : 992 bytes
!
version 15.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname ISP
!
ip cef
no ipv6 cef
license udi pid CISCO2911/K9 sn FTX15246TCV-
!
no ip domain-lookup
!
!
spanning-tree mode pvst
! interface GigabitEthernet0/0 ip address 222.1.1.1 255.255.255.0 duplex auto speed auto
!
interface GigabitEthernet0/1
no ip address
duplex auto
speed auto
shutdown
! interface GigabitEthernet0/2 ip address 100.1.1.2 255.255.255.0 duplex auto speed auto
!
interface FastEthernet0/3/0
switchport mode access
!
interface FastEthernet0/3/1
switchport mode access
!
interface FastEthernet0/3/2
switchport mode access
!
interface FastEthernet0/3/3
switchport mode access
!
interface Vlan1
no ip address
shutdown
!
ip classless ip route 192.168.1.0 255.255.255.0 100.1.1.1
!
ip flow-export version 9
!
!
line con 0
!
line aux 0
!
line vty 0 4
login
!
end