Network settings in FreeBSD

26 خرداد 1402 - خواندن 4 دقیقه - 204 بازدید



Network settings in FreeBSD


/etc/rc.conf 

All service settings in FreeBSD are in this file, you can change the IP address in this file. default settings [Warning: Make a backup of the file before making changes]

hostname="FreeBSD"

ifconfig_em0="DHCP"

sshd_enable="YES"

moused_enable="YES"

ntpd_enable='YES'

#Set dumpdev to 'AUTO' to enable crash dumps, 'NO' to disable

dumpdev='AUTO'


Show the status of the sockets

socketstat


Setting up the FTP service

/etc/rc.d/ftpd onestart [Starting ftpd]

ftp 127.0.0.1

name : user

password : passworduser

/etc/rc.d/ftpd onestop

/etc/rc.d/ftpd onestatus


DNS Servicd 

/etc/resolv.conf


IP Address 

ifconfig en0 192.168.56.10/32

default

The first route in this table specifies the default route. When the local system needs to make a connection to a remote host, it checks the routing table to determine if a known path exists. If the remote host matches an entry in the table, the system checks to see if it can connect using the interface specified in that entry.


If the destination does not match an entry, or if all known paths fail, the system uses the entry for the default route. For hosts on a local area network, the Gateway field in the default route is set to the system which has a direct connection to the Internet. When reading this entry, verify that the Flags column indicates that the gateway is usable (UG).


The default route for a machine which itself is functioning as the gateway to the outside world will be the gateway machine at the Internet Service Provider (ISP).


localhost

The second route is the localhost route. The interface specified in the Netif column for localhost is lo0, also known as the loopback device. This indicates that all traffic for this destination should be internal, rather than sending it out over the network.


MAC address

The addresses beginning with 0:e0: are MAC addresses. FreeBSD will automatically identify any hosts, test0 in the example, on the local Ethernet and add a route for that host over the Ethernet interface, re0. This type of route has a timeout, seen in the Expire column, which is used if the host does not respond in a specific amount of time. When this happens, the route to this host will be automatically deleted. These hosts are identified using the Routing Information Protocol (RIP), which calculates routes to local hosts based upon a shortest path determination.


subnet

FreeBSD will automatically add subnet routes for the local subnet. In this example, 10.20.30.255 is the broadcast address for the subnet 10.20.30 and example.com is the domain name associated with that subnet. The designation link#1 refers to the first Ethernet card in the machine.


Local network hosts and local subnets have their routes automatically configured by a daemon called routed(8). If it is not running, only routes which are statically defined by the administrator will exist.


host

The host1 line refers to the host by its Ethernet address. Since it is the sending host, FreeBSD knows to use the loopback interface (lo0) rather than the Ethernet interface.


The two host2 lines represent aliases which were created using ifconfig(8). The ⇒ symbol after the lo0 interface says that an alias has been set in addition to the loopback address. Such routes only show up on the host that supports the alias and all other hosts on the 

local network will have a link#1 line for such routes.

Mostafa jahanpur