add ip in server

OP
F

free-man20101

New Member


Messages: 13

edit file /etc/rc.conf
and add this line
Code:
ifconfig_em1="inet 192.168.0.2  netmask 255.255.255.248"
ifconfig_em2="inet 192.168.0.3  netmask 255.255.255.248"
and edit /etc/hosts

and reboot server
is this true ?
 

DutchDaemon

Administrator
Staff member
Administrator
Moderator
Developer

Reaction score: 2,954
Messages: 11,352

It is not advisable to put two IP addresses from the same network on two different interfaces. You can however put two IP addresses from the same network on one interface, using the 'alias' option from ifconfig(8) (using a 255.255.255.255 netmask for the aliased IP).
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 9,283
Messages: 33,826

Until you tell us what happens we won't have a clue.

Seriously, you are going to have to put some effort into it. You need to read (at least parts of) the handbook. If English isn't your first language, or you have trouble understanding it, the handbook is also available in other languages.

FreeBSD isn't for people that need to be spoon fed every command.
 

jailed

Active Member

Reaction score: 18
Messages: 170

First, are em1 or em2 really your interfaces?

To be sure,
Code:
pciconf -lv
Find the ethernet devices

e.g:
Code:
rl0@pci0:1:0:0: class=0x020000 card=0x10451043 chip=0x813910ec rev=0x10 hdr=0x00
    vendor     = 'Realtek Semiconductor'
    device     = 'Realtek RTL8139 Family PCI Fast Ethernet NIC (RTL-8139/8139C/8139C)'
    class      = network
    subclass   = ethernet
In this example rl0 on the first line is the interface. Then configure it.

You can also use [CMD=""]sysinstall[/CMD] to configure your network.

sysinstall > Configure > Networking > Interfaces

If you set your config manually, don't forget to set your nameserver in /etc/resolv.conf
 

jailed

Active Member

Reaction score: 18
Messages: 170

To add another IP
Code:
ifconfig_[B]xx0[/B]_alias[B]0[/B]="inet IP netmask NETMASK"
If you will use this machine for gateway/rooter/nat you won't add all the addresses. You will use nat to redirect ip addresses.
 
Top