# Adding additional IP's



## dpalme (Nov 9, 2009)

As it turns out, I have been assigned 5 ip addresses for my machine, of which only one was originally assigned to the box.  Not wanting to screw the machine up, I wanted to run it by here first on the process of adding the additional IP's.

Here is the current snippet from the /etc/rc.conf file:


```
ifconfig_re0="inet 64.150.176.124 netmask 255.255.255.0"
```

I would assume that to add an additional IP address I would only have to add an additional line such as:


```
ifconfig_re1="inet 64.150.176.xxx netmask 255.255.255.0"
```

If that is not correct, I would appreciate someone pointing me in the right direction.


----------



## aragon (Nov 9, 2009)

dpalme said:
			
		

> If that is not correct, I would appreciate someone pointing me in the right direction.




```
ifconfig_re0_alias0="inet 64.150.176.xxx netmask 255.255.255.255"
ifconfig_re0_alias1="inet 64.150.176.xxy netmask 255.255.255.255"
```

Note the netmask.


----------



## jem (Nov 9, 2009)

There is also a new syntax for adding a range of addresses to a single interface:

ipv4_addrs_em0="192.168.0.1-5/24"

This would assign the following addresses to em0:

192.168.0.1/24
192.168.0.2/32
192.168.0.3/32
192.168.0.4/32
192.168.0.5/32

The first address in the range gets the specified /24 netmask.  All the other addresses get the non-conflicting /32 mask.


----------



## jem (Nov 9, 2009)

I should say that syntax is for rc.conf and is available in 7.x.  I don't know when it was introduced so if you're using an older version it might not work.

(Can't edit our own posts on these forums?)


----------



## DutchDaemon (Nov 9, 2009)

jem said:
			
		

> (Can't edit our own posts on these forums?)



Some questions are asked frequently, which is why the answers are in a FAQ list, conveniently located in the forum menu bar.

http://forums.freebsd.org/faq.php?faq=vb3_editing_deleting#faq_postedit


----------



## dpalme (Nov 10, 2009)

If they are part of a different subnet, IE: 69.64.92 do I still make the subnet mask the same?


----------



## aragon (Nov 10, 2009)

dpalme said:
			
		

> If they are part of a different subnet, IE: 69.64.92 do I still make the subnet mask the same?


No, then you assign the first IP in the new subnet its normal netmask.  Subsequent IPs in that same subnet will be /32 again.


----------



## dpalme (Nov 10, 2009)

Here is what I added to the /etc/rc.conf file:


```
ifconfig_re0="inet 64.150.176.124 netmask 255.255.255.0"
ifconfig_re0_alias0="inet 69.64.92.88 netmask 255.255.255.0"
ifconfig_re0_alias1="inet 69.64.92.89 netmask 255.255.255.255"
ipconfig_re0_alias2="inet 69.64.92.90 netmask 255.255.255.255"
ipconfig_re0_alias3="inet 69.64.92.91 netmask 255.255.255.255"
ipconfig_re0_alias4="inet 69.64.92.92 netmask 255.255.255.255"
```

the first aliased IP is reachable and works, the others I get no response from.


----------



## aragon (Nov 10, 2009)

Check the output of "ifconfig re0" to confirm the interface's configuration.

Also try run tcpdump on re0 to ensure the ISP is definitely routing traffic to those addresses to you.


----------



## dpalme (Nov 10, 2009)

ifconfig only reports the primary IP along with the first two aliased.  that is all.

```
re0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
	options=389b<RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,WOL_UCAST,WOL_MCAST,WOL_MAGIC>
	ether 00:16:17:91:6a:8c
	inet 64.150.176.124 netmask 0xffffff00 broadcast 64.150.176.255
	inet 69.64.92.88 netmask 0xffffff00 broadcast 69.64.92.255
	inet 69.64.92.89 netmask 0xffffffff broadcast 69.64.92.89
	media: Ethernet autoselect (100baseTX <full-duplex>)
	status: active
```


----------



## aragon (Nov 10, 2009)

Over here, all three of those addresses are pingable.  Go ahead and add the remaining aliases:


```
ifconfig re0 inet 69.64.92.90/32 alias
ifconfig re0 inet 69.64.92.91/32 alias
ifconfig re0 inet 69.64.92.92/32 alias
```


----------



## dpalme (Nov 10, 2009)

I already added them, but here they are not pingable.


----------



## aragon (Nov 10, 2009)

Odd.  Well, if they're showing up in ifconfig then I'd say try tcpdump to ensure the ISP has routed them correctly too.


----------



## aragon (Nov 10, 2009)

FYI, over here only .91 is unpingable right now.


----------



## dpalme (Nov 10, 2009)

Ok this is weird, I deleted the aliases and added them back one at a time and they are now reachable.  When I added them at the same time they were not.

Thanks for the help


----------



## crsd (Nov 10, 2009)

You have a typo in your rc.conf, i*f*config, not i*p*config.


----------



## dpalme (Nov 10, 2009)

Yeah you are right, I caught it and fixed it, and then you posted...... 

 Nice find, although I never should have missed that.  Stupid stupid mistake.

Thanks for the help though, it is greatly appreciated.

Douglas


----------

