# rc.conf-aliased nics:  how to reflect in nsd?



## MMacD (Oct 22, 2019)

How, if at all, should I reflect in nsd's config, forward and reverse lookup files an ip alias in rc.conf?

E.g., if I have some entry 
	
	



```
ifconfig_igb0_alias0="inet 172.16.1.96 netmask 255.255.255.255"
```
 to which I want to assign a hostdomain name alias as well, how do I reflect that?  Just treat it as though it's a real address and let rc.conf's interpreter sort out the alias aspect?   (This is only for dev purposes at present)


----------



## SirDice (Oct 22, 2019)

You can create as many DNS hostnames as you like but the machine itself can only have one (`hostname=`)[*]. A forward DNS entry (A or AAAA record) can have multiple IP addresses but those will be accessed in a round-robin fashion (First request will return IP A, second IP B, third IP A again, etc). A reverse (PTR) record can only have one hostname.

[*] a jail is treated as a separate machine and can have its own hostname.


----------



## MMacD (Oct 22, 2019)

I think I phrased my question poorly.

My server-of-all-work's hostname is momcat on the local lan local.lan.  I have an alias www, therefore www.local.lan in the forward file that points to the same ip (192.168.0.96). 

What I want to do here is use the same server, aliasing the nic with that 172 address, and make it appear to be an entirely different operation, let's say foo.other_phony_domain.lan.

Do I add entries in the forward file on the order of:

```
$ORIGIN other_phony_domain.lan.
$TTL    86400

@ IN SOA foo.other_phony_domain.lan root.other_phony_domain.lan (
               20160630        ; sn
                8H              ; refresh       8 hours
                2H              ; retry         2 hours
                8H              ; expire        24 hours
                8H              ; min time-to-live
            )

                IN      NS    foo.other_phony_domain.lan
foo          IN      A   172.16.1.96
```

...or something completely different?


----------



## SirDice (Oct 22, 2019)

MMacD said:


> What I want to do here is use the same server, aliasing the nic with that 172 address, and make it appear to be an entirely different operation, let's say foo.other_phony_domain.lan.


An alias address in the same network is going to pose a different kind of problem. Not with DNS but on the host itself. Every connection the host itself makes will use the primary IP address, not the alias. 

With DNS you can create as many hostnames as you like, they don't need to correspond with a 'real' host.


----------



## MMacD (Oct 22, 2019)

If it's going to cause problems, what's the purpose of being able to alias the nic in rc.conf?


----------

