This series of commands might help you configure a Cisco 1921 router for a SOHO environment where many office computers share one Internet connection.
The method I used involves PAT (Port Address Translation) or NAT Overload.
This guide assumes that interface g0/0 will be connected to the Internet (WAN) and g0/1 is on the LAN side.
This guide is by no means fully comprehensive but should enable you to configure the router from a reset.
Here is the software version of the router on which I ran these commands:Cisco IOS Software, C1900 Software (C1900-UNIVERSALK9-M), Version 15.2(4)M8, RELEASE SOFTWARE (fc1)
Configuring Basic Parameters and Remote Access Using SSHv2
Here I connected a serial cable to the light blue ethernet console port on the back of the 1921 router and powered up the device.
--- System Configuration Dialog ---Would you like to enter the initial configuration dialog? [yes/no]: no
(press enter after information scrolls up)Router>Router>enableRouter#conf tRouter(config)#no logging consoleRouter(config)#enable secret Passw0rd1Router(config)#endRouter#exitRouter>enablePassword:Router#>conf tRouter(config)#service password-encryptionRouter(config)#no service configRouter(config)#line vty 0 4Router(config-line)#login localRouter(config-line)#transport input sshRouter(config-line)#exitRouter(config)#username ciscoadmin password Passw0rd2Router(config)#ip domain name mylan.tldRouter(config)#hostname ciscorouterciscorouter(config)#crypto key generate rsa label ssh modulus 1024The name for the keys will be: ssh%The key modulus size is 1024 bits% Generating 1024 bit RSA keys, keys will be non-exportable...[OK] (elapsed time was 1 seconds)ciscorouter(config)# exitciscorouter#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]ciscorouter#
NOTE: If after the router interface addresses have been configured you have issues connecting to the LAN port via SSH, then you might want to try specifying the Ciphers in an ~/.ssh/config file as follows:
Host ciscorouterHostName ciscorouter.mylan.tldCiphers 3des-cbcUser ciscoadmin
Configuring the WAN and LAN Interfaces
The following section assumes that the Internet (g0/0) connection receives DHCP from an ISP.
ciscorouter#conf tciscorouter(config)#int g0/0ciscorouter(config-if)#ip address dhcpciscorouter(config-if)#ip nat outsideciscorouter(config-if)#exitciscorouter(config)#int g0/1ciscorouter(config-if)#ip address 192.168.0.1 255.255.255.0ciscorouter(config-if)#ip nat insideciscorouter(config-if)#exitciscorouter(config)#access-list 101 permit ip any anyciscorouter(config)#ip nat inside source list 101 int g0/0 overloadciscorouter(config)#exitciscorouter#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]ciscorouter#reload reason test1
(confirm)
Hopefully now (after the device reboots) you can use SSH to connect to the LAN port of the router.
Configuring DNS, DHCP, Access Lists and NTP
DNS
ciscorouter>enablePassword:ciscorouter#>conf tciscorouter(config)#ip dns serverciscorouter(config)#ip domain name mylan.tldciscorouter(config)#ip domain lookupciscorouter(config)#ip dns primary 0.168.192.in-addr.arpa soa 192.168.0.1 hostmaster.mylan.tldciscorouter(config)#ip dns primary mylan.tld soa 192.168.0.1 hostmaster.mylan.tldciscorouter(config)#ip host mylan.tld ns ciscorouter.mylan.tldciscorouter(config)#ip host ciscorouter.mylan.tld 192.168.0.1ciscorouter(config)#ip host server.mylan.tld 192.168.0.5
(continue as required)
ciscorouter(config)#ip dns view defaultciscorouter(cfg-dns-view)#dns forwardingciscorouter(cfg-dns-view)#dns forwarder 208.67.220.220ciscorouter(cfg-dns-view)#dns forwarder 208.67.222.222ciscorouter(cfg-dns-view)#domain name-server 192.168.0.1ciscorouter(config)#exitciscorouter#show ip dns view defaultDNS View default parameters:Logging is offDNS Resolver settings:Domain lookup is enabledDefault domain name:mylan.tldDomain search list:Lookup timeout:1 secondsLookup retries:0Domain name-servers:192.168.0.1DNS Server settings:Forwarding of queries is enabledForwarder timeout: 3 secondsForwarder retries: 2Forwarder addresses:208.67.220.220208.67.222.222ciscorouter#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]ciscorouter#
DHCP
ciscorouter#conf tciscorouter(config)#service dhcpciscorouter(config)#ip dhcp pool MYLANciscorouter(dhcp-config)#network 192.168.0.0 255.255.255.0ciscorouter(dhcp-config)#default-router 192.168.0.1ciscorouter(dhcp-config)#dns-server 192.168.0.1ciscorouter(dhcp-config)#ip dhcp excluded-address 192.168.0.0 192.168.0.10ciscorouter(dhcp-config)#endciscorouter#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]ciscorouter#exit
Access Lists
In order to protect services running on the interfaces from abuse, an access list can be assigned.
In this example I will consider the DNS and SSH services for the WAN (g0/0) interface.
Remember that at the end of any access list there is a default (invisible) implicit deny rule. This can be overridden as you will see below (rule 30) but it is worth bearing in mind.
ciscorouter# conf tciscorouter(config)#ip access-list ext 150ciscorouter(config-ext-nacl)#20 deny tcp any any eq 22ciscorouter(config-ext-nacl)#22 deny udp any any eq domainciscorouter(config-ext-nacl)#23 deny tcp any any eq domainciscorouter(config-ext-nacl)#30 permit ip any anyciscorouter(config-ext-nacl)#exitciscorouter(config)#int g0/0ciscorouter(config-if)#ip access-group 150 inciscorouter(config-if)#endciscorouter#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]ciscorouter#exit
NTP
To keep your router synchronised with the correct time, you might find it beneficial to configure the router to talk to an internal NTP server on the LAN interface. In this example, I'll use an internal NTP service which is on 192.168.0.12.
You could integrate the following lines into the previously shown 150 ACL to protect your router from bogus NTP queries. The ACL needs to be assigned to the external interface which in this case is g0/0.
In order to find the IP addresses of the NTP servers that I wanted to contact my internal NTP server, I first resolved as many of the servers' IP addresses from my chosen NTP pool that I could and then added them all into the access list below.
24 permit udp 192.168.0.12. 0.0.0.0.255 any eq ntp log25 permit udp host xxx.xxx.xxx.xxx any eq ntp log26 permit udp host xxx.xxx.xxx.xxx any eq ntp log27 permit udp host xxx.xxx.xxx.xxx any eq ntp log28 deny udp any any eq ntp log29 deny tcp any any eq 123 log
ciscorouter#conf tciscorouter(config)#ntp server 192.168.0.12ciscorouter(config)#int g0/1ciscorouter(config-if)#ntp broadcast clientciscorouter(config-if)#exitciscorouter(config)#exitciscorouter#copy running-config startup-configDestination filename [startup-config]?Building configuration...[OK]ciscorouter#exit
Hopefully your network cup will runneth over when the following occurs.
# sh ntp statusClock is synchronized, stratum 4, reference is xxx.xxx.xxx.xxx
This concludes the basic configuration guide for NAT, DNS, DHCP, Access Lists and NTP on a Cisco 1921 router.