cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1502
Views
0
Helpful
7
Replies

Routing to an interface with DHCP assigned Private IP Address

james bennett
Level 1
Level 1

Hi,

Got a project at work where we're on site and have a cable that assigns a DHCP IP address to say a laptop.  I've been asked if we can share this IP address with anything plugging into the router.

Boviously its nt good practice to route to or NAT private IPs but I need to.  Are there any implications or show stopping issues that might happen if I set a default route on the default VLAN (where all clients plug into)  that routes all traffic through the LAN port that is assigned the DCHP address (essentially this is the WAN port)

I would guess that the DHCP information assigned would supply a default gateway.

Hope this makes sense,

Any feedback great.

James

1 Accepted Solution

Accepted Solutions

Jon Marshall
Hall of Fame
Hall of Fame

James

As an example 192.168.5.0/24 is used for your internal clients

router config

=============

int gi0/0 <-- this is the interface connecting to your switch
ip address 192.168.5.1 255.255.255.0


ip nat inside

int gi0/1  <-- this connects to your cable modem
ip address x.x.x.x y.y.y.y

ip nat outside 

access-list 101 permit ip 192.168.5.0 0.0.0.255

ip nat inside source list 101 interface gi0/1 overload

ip route 0.0.0.0 0.0.0.0

couple of points -

1) i'm not clear on how the router gets it's gi0/1 IP address. If it is via DHCP then the config for gi0/1 would need to be modified.

In addition if it is DHCP then you may need to modify the default route as well ie. either -

a) if the cable modem sends the route as welll use that although you may need to tell your router to do that

or

b) if there is no route passed back and you do not know the IP of the cable modem the default route could point out of the gi0/1 interface rather than to an IP address. This is less efficient but it would work.

2) all your 192.168.5.x addresses are translated to the gi0/1 IP address. This is so you do not need to add a route to the cable modem for the 192.168.5.0/24 network.

Any problems, further queries, please come back

Jon

View solution in original post

7 Replies 7

Jon Marshall
Hall of Fame
Hall of Fame

James

Sorry, but for me at least, i am not understanding your setup.

What do you mean by "a cable" for example ?

Can you perhaps explain all the devices and how they connect up and what you want to happen to traffic and where that traffic is coming from and going to ?

Like i say, it could just be me, so please don't take it personally

Jon

Sorry Jon, perhaps a bit vague there

OK by cable I mean, if you can picture your home broadband, plugging the cable into your internal router where by you have an Ethernet connection and say for example your laptop is assigned an internal IP address along with a subnet mask, gateway and some DNS servers.

I need to share this connection by using an interface on my router as the WAN.  If the interface (lets call it interface 0/1) is given an IP addess 192.168.1.50\24 and workstations pluggin into the same router come from a different IP range(that is assigned to the LAN interface on my router) Can I router between interfaces without any issues???

Hope this makes sense...

James

So it looks like this -

clients ->  gi0/0 router gi0/1 -> cable modem -> internet

and you want clients sending traffic to gi0/0 to be able to go out through the router ?

Can you just confirm as i don't want to babble on if i have got it wrong (sorry, it's been a long day )

So if the above is right your clients will connect to a switch which connects to gi0/0 and your cable modem device does NAT for the internal clients to a public IP ?

Jon

Thats pretyy much it, just missed one thing.

You said:

So if the above is right your clients will connect to a switch which  connects to gi0/0 and your cable modem device does NAT for the internal  clients to a public IP ?

The only thing different in my situaltion that that the Device is doing NAT to a private IP address not a public address, before passing traffic on to the cable modem.

HTH

James

Missed a bit:  Interface Gi0/1 is getting a private IP address from the cable modem...

Jon Marshall
Hall of Fame
Hall of Fame

James

As an example 192.168.5.0/24 is used for your internal clients

router config

=============

int gi0/0 <-- this is the interface connecting to your switch
ip address 192.168.5.1 255.255.255.0


ip nat inside

int gi0/1  <-- this connects to your cable modem
ip address x.x.x.x y.y.y.y

ip nat outside 

access-list 101 permit ip 192.168.5.0 0.0.0.255

ip nat inside source list 101 interface gi0/1 overload

ip route 0.0.0.0 0.0.0.0

couple of points -

1) i'm not clear on how the router gets it's gi0/1 IP address. If it is via DHCP then the config for gi0/1 would need to be modified.

In addition if it is DHCP then you may need to modify the default route as well ie. either -

a) if the cable modem sends the route as welll use that although you may need to tell your router to do that

or

b) if there is no route passed back and you do not know the IP of the cable modem the default route could point out of the gi0/1 interface rather than to an IP address. This is less efficient but it would work.

2) all your 192.168.5.x addresses are translated to the gi0/1 IP address. This is so you do not need to add a route to the cable modem for the 192.168.5.0/24 network.

Any problems, further queries, please come back

Jon

Thanks for your reply, Jon.  This makes sense now.  I don't and wont know the IP address the Cable modem will be assigning so will go with the default route through the interface.

I've got a lab so will test things out - thanks for your help

James

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Review Cisco Networking products for a $25 gift card