neversoft 发表于 2018-7-16 08:54:48

CISCO路由器学习

!  version 12.1
  service timestamps debug uptime
  service timestamps log uptime
  no service password-encryption
  !
  hostname isgod<--本机名
  !
  boot system flash
  no logging buffered
  enable secret 5 $1$x178$CakJRLZIrFmpnfA2gv0jX1
  !
  ip subnet-zero
  !
  interface Ethernet0/0<--向外端口
  ip address 111.111.111.20 255.255.255.0<--端口IP
  ip nat outside<--表记向外NAT
  !
  interface Ethernet0/1<--向内端口
  ip address 192.168.101.3 255.255.254.0 secondary<--端口的第二个IP,可设多个
  ip address 192.168.101.1 255.255.254.0<--主IP
  ip nat inside<--表记向内NAT
  !
  ip nat translation tcp-timeout 1200 <-当客户端多时,加上此句(20分钟关闭tcp端口)否则端口满时,有些会连不上。缺省为24小时
  ip nat pool nat-1 111.111.111.20 111.111.111.20 netmask 255.255.255.0<--设置一个公网上的IP池,在这里只有一个公用IP,它的别名为nat_1。
  ip nat inside source list 100 pool nat-1 overload<--对内端口使用NAT,并使用访问表1
  ! 注意如果只有一个对外的IP,以上两行也可用此行代替:ip nat inside source list 100 interface Ethernet0/0 overload

  ip>  ip route 0.0.0.0 0.0.0.0 111.111.111.11<--缺省路由
  no ip http server<--不提供机上的HTTP服务
  !
  !设端口输入时运用扩展访问表组,组号100。普通访问表组为1-99,扩展的为100-199。两者区别为扩展的能使用端口号
  access-list 100 permit ip 192.168.100.32 0.0.0.7 any<-- 对访问表100,192.168.100.32后8个地址向外能访问
  access-list 100 permit tcp 192.168.100.0 0.0.1.255 any eq www<-- 192.168.100.0/23能访问HTTP
  access-list 100 permit tcp 192.168.100.0 0.0.1.255 any range ftp-data smtp<--能访问FTP,发邮件等,端口20-25
  access-list 100 permit tcp 192.168.100.0 0.0.1.255 any eq pop3<--能收邮件
  access-list 100 permit tcp 192.168.100.0 0.0.1.255 any eq 443<--能HTTPS
  access-list 100 permit udp 192.168.100.0 0.0.1.255 any eq domain <--能DNS
  access-list 100 permit icmp 192.168.100.0 0.0.1.255 any<--能对外PING
  !
  line con 0
  password XXXX
  login
  transport input none
  line aux 0
  line vty 0 4
  password XXXX
  login
  !
  end
页: [1]
查看完整版本: CISCO路由器学习