ISP
配置// 创建用户账号信息
ISP(config)#username cisco password ccie
// 创建ip地址池,可以是一个地址也可以是一个范围的地址
// 该地址池也可以用ip dhcp pool ipspool来创建,和dhcp服务共用池
ISP(config)#ip local pool ccieips 202.101.1.10
// 创建虚拟接口模板
ISP(config)#int virtual-template 1
// 需要在虚拟接口上配置IP地址,而不是在物理接口上
ISP(config-if)#ip address 202.101.1.1 255.255.255.0
// LCP,链路层协商,在虚拟接口封装PPP协议
ISP(config-if)#encapsulation ppp
// 指定认证的协议
ISP(config-if)#ppp authentication pap
// NCP,网络层协商 从地址池中获取地址, 用来下发IP地址
ISP(config-if)#peer default ip address pool ccieips
// 配置空闲时长, 超过自动断开,单位秒
ISP(config-if)#ppp timeout idle ?
<1-4294967> Idle timeout value in seconds
// 做以一个优化 因为PPPoE会额外的添加8字节的开销,防止超过MTU导致丢包
ISP(config-if)#ip mtu 1492
ISP(config-if)#no shutdown
ISP(config-if)#exit
// 用BBA组与虚拟接口模板关联
ISP(config)#bba-group pppoe ISP
ISP(config-bba-group)#virtual-template 1
ISP(config-bba-group)#exit
ISP(config)#int e0/1
ISP(config-if)#no shutdown
ISP(config-if)#pppoe enable group ISP
ISP(config-if)#exit
// 启用DNS服务
ISP(config)#ip dns server
// 添加解析记录
ISP(config)#ip host www.test.local 8.8.8.8
ISP(config)#int e0/0
ISP(config-if)#ip address 8.8.8.8 255.255.255.0
ISP(config-if)#no shutdown
ISP(config-if)#
OR
基础配置配置dhcp
服务
OR(config)#ip dhcp pool HOME
OR(dhcp-config)#network 192.168.10.0 255.255.255.0
OR(dhcp-config)#default-route 192.168.10.254
OR(dhcp-config)#dns-server 8.8.8.8
OR(dhcp-config)#exit
OR(config)#ip dhcp excluded-address 192.168.10.254
OR(config)#int e0/0
OR(config-if)#ip address 192.168.10.254 255.255.255.0
OR(config-if)#no shutdown
OR(config-if)#
PC1(config)#no ip routing
PC1(config)#int e0/0
PC1(config-if)#ip address dhcp
PC1(config-if)#no shutdown
OR
配置PPPOE拨号
// 先创建拨号口
OR(config-if)#int dialer 1
// LCP阶段指定封装PPP协议
OR(config-if)#encapsulation ppp
// 修正包大小
OR(config-if)#ip mtu 1492
// ip地址协商
OR(config-if)#ip address negotiated
// NCP阶段 添加一条默认路由到PPPOE服务端
OR(config-if)#ppp ipcp route default
// 创建拨号池
OR(config-if)#dialer pool 1
OR(config-if)#no shutdown
OR(config-if)#exit
// 进入接口关联拨号池
OR(config)#int e0/1
//OR(config-if)#pppoe enable group global
OR(config-if)#pppoe-client dial-pool-number 1
OR(config-if)#no shutdown
OR(config-if)#int dialer 1
OR(config-if)#ip nat outside
OR(config-if)#int e0/0
OR(config-if)#ip nat inside
OR(config-if)#exit
OR(config)#ip access-list standard NAT-PAT
OR(config-std-nacl)#permit 192.168.10.0 0.0.0.255
OR(config-std-nacl)#exit
OR(config)#ip nat inside source list NAT-PAT interface dialer 1 overload
OR(config)#do show ip nat translations
PC1
测试结果PC1#ping www.test.local
Translating "www.test.local"...domain server (8.8.8.8) [OK]
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 8.8.8.8, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/2 ms
PC1#
OR
路由器
OR(config)#do show ip route
Codes: L - local, C - connected, S - static, R - RIP, M - mobile, B - BGP
D - EIGRP, EX - EIGRP external, O - OSPF, IA - OSPF inter area
N1 - OSPF NSSA external type 1, N2 - OSPF NSSA external type 2
E1 - OSPF external type 1, E2 - OSPF external type 2
i - IS-IS, su - IS-IS summary, L1 - IS-IS level-1, L2 - IS-IS level-2
ia - IS-IS inter area, * - candidate default, U - per-user static route
o - ODR, P - periodic downloaded static route, H - NHRP, l - LISP
a - application route
+ - replicated route, % - next hop override
Gateway of last resort is 101.1.1.254 to network 0.0.0.0
S* 0.0.0.0/0 [1/0] via 101.1.1.254
101.0.0.0/32 is subnetted, 2 subnets
C 101.1.1.1 is directly connected, Dialer1
C 101.1.1.254 is directly connected, Dialer1
192.168.10.0/24 is variably subnetted, 2 subnets, 2 masks
C 192.168.10.0/24 is directly connected, Ethernet0/0
L 192.168.10.254/32 is directly connected, Ethernet0/0
OR(config)#do show ip nat translations
Pro Inside global Inside local Outside local Outside global
icmp 101.1.1.1:0 192.168.10.1:0 8.8.8.8:0 8.8.8.8:0
OR(config)#