Network configuration in FreeBSD
Giorgos Keramidas
keramida at ceid.upatras.gr
Mon Jan 28 18:37:32 PST 2008
On 2008-01-28 21:03, Bhuvaneswari Ramkumar <ramkumar at iastate.edu> wrote:
> ok here u go, the exact output of the the commands:
Excellent! Thank you :-)
> #ifconfig -a
>
> em0: flags=8802<BROADCAST, SIMPLEX, MULTICAST> mtu 1500
> options=b<RXSCUM, TXSCUM, VLAN_MTU>
> ether :0d:56:f0:f1:ba
> media:Ethernet autoselect (100baseTX <full-duplex>)
> status: active
>
> plip0:flags=108810<POINTTOPOINT,SIMPLEX,MULTICAST> mtu 1500
> lo0:flags=8049<UP, LOOPBACK,RUNNING,MULTICAST> MTU 16384
> inet 127.0.0.1 netmask 0xff000000
> inet ::1 prefixlen 128
> inet6 fe80 :: 1% lo0 prefixlen 64 scopeid 0x3
See the `active' status and the `media' description? This means you
have a network cable connected and FreeBSD has autodetected that you are
using a full-duplex 100 Mbit/s link.
That's good :)
On 2008-01-28 21:10, Bhuvaneswari Ramkumar <ramkumar at iastate.edu> wrote:
> the netstat reads:
>
> #netstat -nr
>
> Routing tables
>
> Internet:
> Destination Gateway Flags REfs Use Netif Expire
> 127.0.0.1 127.0.0.1 UH 0 41 lo0
>
>
> Internet 6
>
> Destination Gateway Flags Netif
> Expire
> ::1 ::1 UH lo0
> fe80::%lo0/64 fe80::1%lo0 U lo0
> fe80::1%lo0 link#3 UHL lo0
> ff01::/32 ::1 U lo0
> ff02 :: %lo0/32 ::1 UC lo0
Hmmm. There seems to be something very 'odd' about your interfaces.
* There is no `lo0' loopback interface, which commonly uses the
127.0.0.1 address.
* The 127.0.0.1 address is assigned to plip0 (IP over parallel
port), which seems wrong.
* The em0 interface has no address.
Can you try the following commands, so see if you can *manually* set up
the interfaces?
1. Bringing down the 'plip0 interface
-------------------------------------
# ifconfig plip0 unplumb
This should bring down and delete the plip0 interface. You don't really
need it when em0 starts working.
2. Bringing up the `lo0' loopback interface
-------------------------------------------
# ifconfig lo0 inet 127.0.0.1/32 up
This will bring up the `lo0' interface, with the correct address.
3. Bringing up the em0 interface
--------------------------------
Finally, try bringing up the `em0' interface with dhclient OR ifconfig.
You don't need *both*. One of them should be sufficient...
3.1. Using a dynamic/automatic address for em0
----------------------------------------------
If you are using DHCP (automatic address configuration, i.e. from a DSL
modem, or similar) it should be sufficient to run:
# dhclient em0
3.2. Using a static address for em0
-----------------------------------
If you are not using DHCP, and you have a `static' address, like the one
I use on the workstation I'm using to type this, you should be able to
use ifconfig like:
# ifconfig inet a.b.c.d/count up
where `a.b.c.d' is the IP address you want to assign, and `count' a
number like `24' or `28'. The correct settings depends on how your
network is configured, but an example would look like:
# ifconfig em0 192.168.1.180/24 up
4. Check that em0 really got an address and is "UP"
---------------------------------------------------
Then you should see something like:
em0: flags=8802<UP,BROADCAST, SIMPLEX, MULTICAST> mtu 1500
options=b<RXSCUM, TXSCUM, VLAN_MTU>
ether :0d:56:f0:f1:ba
inet 192.168.1.180 netmask 0xffffff00 broadcast 192.168.1.255
media:Ethernet autoselect (100baseTX <full-duplex>)
status: active
5. Add the default router/gateway
---------------------------------
If you see the "UP" flag in the first line, and you get the `inet' line
options correctly (address and netmask), the final step should be to
configure the `default router', i.e.:
# route add default 192.168.1.1
6. Saving it all in `/etc/rc.conf' for the next boot
----------------------------------------------------
If you get all the steps right, and you _do_ get connectivity going,
then you should be able to manually edit the file `/etc/rc.conf' and set
configure everything by using something similar to:
network_interfaces='lo0 em0'
ifconfig_lo0='inet 127.0.0.1/32'
ifconfig_em0='inet 192.168.1.180/24'
defaultrouter='192.168.1.1'
The syntax is really simple, but if you need an explanation of what it
all means, please feel free to ask :)
- Giorgos
More information about the freebsd-questions
mailing list