Networking-Blog

My WordPress Blog

Cisco – Disabling NBT via DHCP Option 43

The default setting in windows is to “Use NetBIOS setting from the DHCP server.
If static IP address is used or the DHCP server does not provide NetBIOS setting,
enable NetBIOS over TCP/IP.”  In other words, if you don’t specifically tell your
windows machines to disable NBT, it will remain on.

Microsoft implemented a vendor specific DHCP option to instruct clients to either enable
or disable NBT.  DHCP option 43 is for vendor specific options.  Basically, the DHCP server
can return option 43 and inside option 43 you can have vendor specific sub-options.

I will give you the basic idea:  The DHCP server is configured to return option 43 with the
following subcode structure:

Vendor specific option code: 0×01
Vendor specific option length: 0×04

Vendor specific option data:

This can vary based on what you want to do. The data 0×00000002 instructs the client to
disable NBT

With this knowledge, we can setup our Cisco router DHCP server to hand out this
option 43 with the correct sub-options to disable NBT.

Here is an example :

ip dhcp pool LAN
import all
network 10.1.10.0 255.255.255.0
default-router 10.1.10.1
domain-name astorinonetworks.com
option 43 hex 0104.0000.0002
!
!
.0000
Enables NetBIOS over TCP/IP (Default Value) for that network interface.

!
.0002
Disables NetBIOS over TCP/IP for that network interface.
!
!
This option can be used to enable or disable the use of NetBIOS over TCP/IP on the
network interface for which the DHCP message was received. DHCP clients SHOULD
support this option. If the use of
NetBIOS over TCP/IP is disabled on the interface,
no NetBIOS over TCP/IP packets can be sent from or received on that interface.

If any NetBIOS over TCP/IP packets are sent to the client on that interface, they are
silently discarded.
This option has no effect on NetBIOS over NetBEUI.

CISCO – Port forwarding a range of ports

ip nat pool MEDIA_SERVER 192.168.2.4 192.168.2.4 prefix-length 28 type rotary
ip nat inside destination list MEDIA_SERVER_NAT_PORTS pool MEDIA_SERVER
!
ip access-list extended MEDIA_SERVER_NAT_PORTS
permit tcp any host 192.168.0.2 eq 21
permit tcp any host 192.168.0.2 eq 222
permit tcp any host 192.168.0.2 eq 3000
permit tcp any host 192.168.0.2 eq 5938
permit udp any host 192.168.0.2 eq 6881
permit tcp any host 192.168.0.2 eq 50518
permit udp any host 192.168.0.2 eq 50518
!
!
ip nat pool CCTV 172.16.0.2 172.16.0.2 prefix-length 30 type rotary
ip nat inside destination list CCTV_NAT_PORTS pool CCTV
!
ip access-list extended CCTV_NAT_PORTS
permit tcp any host 192.168.0.2 eq 81
permit tcp any host 192.168.0.2 eq 37777
!
!

“host 192.168.0.2“ is the WAN facing interface Public Ip Address access to the Internet.

Cisco – NAT Port Address Translation

Port Address Translation
NAT Translate Source tcp port 22 = ssh to Destination Service Port 22=ssh.
ip nat inside source static tcp 192.168.1.1 22 interface Dialer0 22
!
!

NAT Translate Source tcp port 10001 to Destination Service Port 22=ssh.
ip nat inside source static tcp 192.168.2.1 22 interface Dialer0 10001

!

Note that the configuration description for the static NAT command indicates any
packet received in the inside interface with a source address of  192.168.2.1.22 is
translated to 0.0.0.0:10001.

This also implies that any packet received on the outside interface with a destination
address of 172.16.10.8:80 has the destination translated to
172.16.10.8:8080.

!
Allow tcp port 22 or 10001 on the firewall WAN facing ACL as incoming from the Internet.

Eg :

ip access-list extended INTERNET
permit ip any any eq 22
permit ip any any eq 10001

!

ip nat inside source static 172.16.50.8 172.16.10.8

!--- States that any packet received on the inside interface with a
!--- source IP address of 172.16.50.8 is translated to 172.16.10.8.
Note that the inside source NAT command in this example also implies that
packets received on the outside interface with a destination address of
172.16.10.8 has the destination address translated to 172.16.50.8.

Difference between One-to-One Mapping and Many-to-Many  
A static NAT configuration creates a one-to-one mapping and translates a specific address to another address. This type of configuration creates a permanent entry in the NAT table as long as the configuration is present and enables both inside and outside hosts to initiate a connection. 
This is mostly useful for hosts that provide application services like mail, web, FTP and so forth. For example:
Router(config)#ip nat inside source static 10.3.2.11 10.41.10.12
Dynamic NAT is useful when fewer addresses are available than the actual number of hosts to be translated. It creates an entry in the NAT table when the host initiates a connection and establishes a one-to-one mapping between the addresses.But, the mapping can vary and it depends upon the registered address available in the pool at the time of the communication. Dynamic NAT allows sessions to be initiated only from inside or outside networks for which it is configured. 
Dynamic NAT entries are removed from the translation table if the host does not communicate for a specific period of time which is configurable. The address is then returned to the pool for use by another host.
For example, complete these steps of the detailed configuration:
Create a pool of addresses
Router(config)#ip nat pool MYPOOLEXAMPLE
10.41.10.1 10.41.10.41 netmask 255.255.255.0 !
Create an access-list for the inside networks that has to be mapped
Router(config)#access-list 100 permit ip 10.3.2.0 0.0.0.255 any
Associate the access-list 100 that is selecting the internal network 10.3.2.0 0.0.0.255 to be natted to the pool MYPOOLEXAMPLE and then overload the addresses.
Router(config)#ip nat inside source list 100 pool MYPOOLEXAMPLE overload

Cisco – Configuring WAN Interface Failover

In the process of researching how to configure WAN interface failover in IOS (Cisco),
I came across a few different ways of doing it, but have opted for the solution below,
which relies on a backup static route, using object tracking to keep the primary route up.

Concept:
Small business with a single router (i.e Cisco 1811 ISR), has two ISPs, and would like to use
one ISP as the main provider, and the second ISP as a backup in case the first one fails.

1) Configure each WAN interface to connect to each ISP, respectively:

interface FastEthernet 0/0
description primary-WAN
ip address 10.1.1.1 255.0.0.0

interface FastEthernet 0/1
description backup-WAN
ip address 10.2.2.2 255.0.0.0

2) Create the Route Maps that will be used for NATting traffic:

route-map isp1-primary permit 10
match ip address 100
match interface FastEthernet0/0

route-map isp2-backup permit 10
match ip address 100
match interface FastEthernet0/1

Note: ACL 100 allows traffic from the LAN.

3) Configure the two NAT statements required so that either interface can
provide NATting, out each respective WAN interface:

ip nat inside source route-map isp1-primary interface FastEthernet0/0
overload
ip nat inside source route-map isp2-backup interface FastEthernet0/1
overload

4) Setup a “Tracking Object”:

ip sla 100
icmp-echo 8.8.8.8 source-interface Fastethernet0
timeout 500
frequency 3

Note: This tracking object will ping 8.8.8.8 (Google’s DNS servers) through Fastethernet0
(Primary WAN interface) every 3 seconds, and will timeout in 500 ms if a response is
not received.

5) Create a schedule for the tracking object to run:

ip sla schedule 100 life forever start-time now

Note: This starts the tracking immediately, and stays on indefinitely.

6) Track the object:

track 100 rtr 100 reachability
delay down 10 up 20

7) Update your static routes:

ip route 0.0.0.0 0.0.0.0 FastEthernet0/0 <next-hop> track 100
ip route 0.0.0.0 0.0.0.0 FastEthernet0/1 <next-hop> 10

Note: The first static route is installed as long as the tracked object (100) doesn’t fail.
The second static route would take over traffic if the first route is not installed, since its
priority (administrative distance) is lower.

ROUTE-MAP RE-ROUTE TRAFFIC

ip access-list extended REROUTE1
permit ip any 85.234.86.0 0.0.0.255
!
!
ip access-list extended REROUTE2
permit ip any 85.234.86.0 0.0.0.255
!
!
route-map Alternative_route permit 20
match ip address REROUTE1
set interface Dialer0
!
route-map Alternative_route permit 30
match ip address REROUTE2
set metric 200
set default interface Vlan1
!
!
int vlan 1
ip policy route-map Alternative_route
!
!
ip route 0.0.0.0 0.0.0.0 192.168.0.222
ip route 80.74.16.0 255.255.255.0 Dialer0
ip route 80.74.17.9 255.255.255.255 Dialer0

ROUTE-MAP RE-ROUTE NAT TRAFFIC..

ip nat inside source route-map wireless interface fastethernet0/0 overload
ip nat inside source route-map t1 interface fastethernet0/1 overload

!
access-list 1 permit 192.168.1.0 0.0.0.255
access-list 2 permit 192.168.1.0 0.0.0.255

!
route-map wireless permit 10
match ip address 1
match interface fastethernet0/0

!
route-map t1 permit 10
match ip address 2
match interface fastethernet0/1

!
ip route 0.0.0.0 0.0.0.0 1.1.1.1
ip route 0.0.0.0 0.0.0.0 2.2.2.1 20

CISCO PORT RANGE STATIC NAT

ip nat inside source list 10 interface Dialer1 overload
!
ip nat pool groupA 10.11.0.1 10.11.0.1 netmask 255.255.255.0 type rotary
ip nat pool groupB 10.11.0.2 10.11.0.2 netmask 255.255.255.0 type rotary
!
ip nat inside destination list 101 pool groupA
ip nat inside destination list 102 pool groupB
!
!

access-list 10 permit ip 10.11.0.0 0.0.0.255
access-lsit 101 permit tcp any any range 8000 9400
access-list 102 permit tcp any any range 50 1024

Named Access-List…

ip nat pool CCTV 192.168.200.20 192.168.200.20 prefix-length 24 type rotary
ip nat inside destination list CCTV_PORTS pool CCTV
!
ip access-list extended CCTV_PORTS
permit tcp any any range 15000 15007
permit udp any any range 15000 15200

CISCO ADSL LLU

interface ATM0
description SKYBB-ADSL-LLU
no ip address
interface ATM0.1 point-to-point
description SKY Broadband
bandwidth 8000
pvc DATA 0/38
vbr-nrt 448 448 1
tx-ring-limit 3
encapsulation aal5mux ppp dialer
dialer pool-member 1
!
interface Dialer0
description SKY Broadband
ip address negotiated
encapsulation ppp
dialer pool 1
dialer-group 1
ppp authentication chap pap callin
ppp chap hostname 000000000000@skydsl
ppp chap password 0 1111111111
ppp pap sent-username 000000000000@skydsl password 0 1111111111
!
dialer-list 1 protocol ip permit

Cisco IP Route RFC Drop

ip route 10.0.0.0 255.0.0.0 Null0 name “RFC1918 Drop“
ip route 127.0.0.0 255.0.0.0 Null0 name “Loopback Drop“
ip route 169.254.0.0 255.255.0.0 Null0 name “Autoconfiguration IP Addresses“
ip route 172.16.0.0 255.240.0.0 Null0 name “RFC1918 Drop“
ip route 192.168.0.0 255.255.0.0 Null0 name “RFC1918 Drop”
ip route 10.0.0.0 255.0.0.0 Null0 name “RFC1918 Drop”
ip route 127.0.0.0 255.0.0.0 Null0 name “Loopback Drop”
ip route 169.254.0.0 255.255.0.0 Null0 name “Autoconfiguration IP Addresses”
ip route 172.16.0.0 255.240.0.0 Null0 name “RFC1918 Drop”
ip route 192.168.0.0 255.255.0.0 Null0 name “RFC1918 Drop“