Assign 2 IPs to one device

Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking
Author Message
JackPollack
DD-WRT User


Joined: 22 May 2015
Posts: 60

PostPosted: Wed Jan 05, 2022 4:28    Post subject: Assign 2 IPs to one device Reply with quote
My real NAS died and I want to replace it with the NAS function on the DDWRT router. Its a bit slower but usable for my needs.

The old NAS had an IP of 192.168.1.100 and the router has 192.168.1.1

I also have a NAS at work with the same IP as my home so devices and laptops with shortcuts can move back and forth without issue.

Some devices access the NAS using the NETBIOS name (//NAS/share) but many of the laptops (mostly Macs) have trouble with the NETBIOS name and use the IP (//192.168.1.100/share)

I'm pretty sure this is not possible but what want to do is assign 2 IPs to the router so devices can still use .1 for the gateway and .100 for the NAS. I realize that if it is possible someone could access the NAS at .1 (not an issue). I just dont want to have to remap everything and I want it to remain consistent with addressing at my office.
Sponsor
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 9157

PostPosted: Wed Jan 05, 2022 5:15    Post subject: Reply with quote
Add the following to the startup script.

Code:
(
until ping -qc1 -W3 8.8.8.8 &>/dev/null; do sleep 10; done
ifconfig br0:1 192.168.1.100 netmask 255.255.255.0
) &

_________________
ddwrt-ovpn-split-basic.sh (UPDATED!) * ddwrt-ovpn-split-advanced.sh (UPDATED!) * ddwrt-ovpn-client-killswitch.sh * ddwrt-ovpn-client-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
egc
DD-WRT Guru


Joined: 18 Mar 2014
Posts: 12889
Location: Netherlands

PostPosted: Wed Jan 05, 2022 9:06    Post subject: Reply with quote
Probably also make sure you do not start your DHCP scope at 100 not sure with will happen otherwise.

Maybe DNSMasq is smart enough to compensate for this?

_________________
Routers:Netgear R7000, R6400v1, R6400v2, EA6900 (XvortexCFE), E2000, E1200v1, WRT54GS v1.
Install guide R6400v2, R6700v3,XR300:https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=316399
Install guide R7800/XR500: https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320614
Forum Guide Lines (important read):https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=324087
JackPollack
DD-WRT User


Joined: 22 May 2015
Posts: 60

PostPosted: Wed Jan 05, 2022 20:01    Post subject: Thanks Reply with quote
Did a quick test and it looks like it worked.
Thank you

just curious, before reassigning br0:1 to my new IP it was bound to a non routable IP 169.254.39.25.

Could you explain or point me to a link where they explain what br0:1 is and why it had that IP. Basically I want to understand what I just did. Thanks
eibgrad
DD-WRT Guru


Joined: 18 Sep 2010
Posts: 9157

PostPosted: Wed Jan 05, 2022 20:56    Post subject: Reply with quote
br:# is just the syntax required to associate additional IP addresses to the br0 network interface (aka, multihome). Until you assign an IP to br0:1, it doesn't really exist. If you issue the command 'ifconfig br0:1' (no quotes) before the IP assignment, all you typically see is the base information for the br0 network interface. So I have no idea why it would have been assigned 169.254.39.25 (an APIPA address) unless something else had already attempted to configure br0:1 (if so, change it to br0:2).

APIPA addresses are indeed very routable. These are self-assigned by the client from the 169.254.x.x. network when the client doesn't receive a response from a DHCP server, the theory being that devices should still be able to communicate in the absence of a DHCP server.

_________________
ddwrt-ovpn-split-basic.sh (UPDATED!) * ddwrt-ovpn-split-advanced.sh (UPDATED!) * ddwrt-ovpn-client-killswitch.sh * ddwrt-ovpn-client-watchdog.sh * ddwrt-ovpn-remote-access.sh * ddwrt-ovpn-client-backup.sh * ddwrt-mount-usb-drives.sh * ddwrt-blacklist-domains.sh * ddwrt-wol-port-forward.sh * ddwrt-dns-monitor.sh (NEW!)
JackPollack
DD-WRT User


Joined: 22 May 2015
Posts: 60

PostPosted: Wed Jan 05, 2022 22:21    Post subject: Got it. Thank you Reply with quote
I actually meant self-assigned not non ruotable.

Very Happy

Thank you
tedm
DD-WRT Guru


Joined: 13 Mar 2009
Posts: 555

PostPosted: Sat Jan 08, 2022 17:48    Post subject: Reply with quote
It should be worth nothing that this hack is not necessary if you use proper internal DNS servers and name your NAS devices in the DNS. I'm sure eibgrad knows this but you should be at least told that what your doing is a hack and not the proper way to do things. (not that I have any illusions that you give a tinkers damn ha ha)

This is also why your Mac's are upchucking at the "smb" name. They want to see the smb name in either dns, either a unicast DNS server like BIND or a multicast dns server like mdnsresponder (Apple calls it with the idiotic name "Bonjour" which they trademarked)
JackPollack
DD-WRT User


Joined: 22 May 2015
Posts: 60

PostPosted: Sat Jan 08, 2022 19:56    Post subject: Can DDWRT act as an internal DNS Server? Reply with quote
Adding second IP appears to be working but would prefer to do it the correct way.

Can DDWRT act as an internal DNS Server?
Can you point me to a how to?

Thanks
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Index -> Advanced Networking All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum