Setting up IP addresses for websites

bdl

New Member


Messages: 1

Hi folks! Four-year member, first-time poster here.

I have been running some WordPress sites on a FreeBSD VPS off and on for a couple years. To do this I have just installed the basics: MySQL, PHP, WordPress, NGINX, etc. WordPress and FreeBSD have worked so well together after that, that I've never had to learn to do much down in the OS itself.

But now I'm looking to upgrade to a #baremetal dedicated server for my five sites, and I'll have five IP addresses available (one per website) whereas they used to all share a single IP. So my question is: how in the world do I set up separate IP addresses for websites on a new server? And a related question that may be part of the answer above: how do I set up my own name servers (ns1.mydomain.com, etc.)?

I used to use the name servers of my VPS provider, but the #baremetal provider does not have that same service.

Thank you much for any help you can provide. I'm sure it's a simple thing to do, I just can't seem to find any simple tutorials for this like they have at VPS providers like DO for most everything else.
 

leebrown66

Well-Known Member

Reaction score: 137
Messages: 411

To create multiple IP addresses on the same interface, look at ifconfig_*_aliases in rc.conf(5)
Code:
# cat /etc/rc.conf
ifconfig_xn0="inet 10.1.2.3/24"
ifconfig_xn0_aliases="inet 10.1.2.4/32 10.1.2.5/32"
# ifconfig xn0
xn0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=503<RXCSUM,TXCSUM,TSO4,LRO>
        ether 00:00:00:00:00:00
        inet 10.1.2.3 netmask 0xffffff00 broadcast 10.1.2.255
        inet 10.1.2.4 netmask 0xffffffff broadcast 10.1.2.4
        inet 10.1.2.5 netmask 0xffffffff broadcast 10.1.2.5
For your own DNS server, let's say your website is called www.example.com. You own the example.com domain and the registrar typically provides controls for the various DNS records, so you would add www and set it's IP address to your new host.

Personally I'd advise against setting up a DNS server for your own domain, rather leave it pointing at the registrar and use their interface to modify their records. They are (or should be) capable of handling a DoS attack against their DNS servers, will you be? The domain registrar controls are where you will be able to change the DNS for your domain. You can use whois(1) on the domain to discover the registrar.
 
Top