pavement

Network Configuration (basic)

From FreeBSDwiki
(Difference between revisions)
Jump to: navigation, search
Line 3: Line 3:
 
The "newbiest" method is to use the text-GUI menu-driven method of hitting up /stand/sysinstall and going through Configure, Networking, Interfaces, and pick the particular network interface you want to configure.  This is very simple and easy and will make all the actual changes in the proper system configuration file for you.
 
The "newbiest" method is to use the text-GUI menu-driven method of hitting up /stand/sysinstall and going through Configure, Networking, Interfaces, and pick the particular network interface you want to configure.  This is very simple and easy and will make all the actual changes in the proper system configuration file for you.
  
The alternate way to do it is to manually edit [[/etc/rc.conf]] (and possibly [[/etc/resolv.conf]]) yourself.  Keep in mind that rc.conf is designed to be a "delta" file; it basically consists of a series of patches to apply to the basic system rc.conf file in /etc/defaults.  If you're feeling REALLY leet, you can monkey around in that too (or the rc scripts themselves), but I strongly recommend that you don't - just stick to making your changes in '''/etc/rc.conf'''.  One thing to remember is that since rc.conf is a "patch" style delta file, it can contain (and if you've been using '''/stand/sysinstall''', WILL contain) more than one line configuring the same parameter - in which case the last line in the file is the one that takes the final effect.
+
The alternate way to do it is to manually edit [[ /etc/rc.conf]] (and possibly [[/etc/resolv.conf]]) yourself.  Keep in mind that rc.conf is designed to be a "delta" file; it basically consists of a series of patches to apply to the basic system rc.conf file in /etc/defaults.  If you're feeling REALLY leet, you can monkey around in that too (or the rc scripts themselves), but I strongly recommend that you don't - just stick to making your changes in '''/etc/rc.conf'''.  One thing to remember is that since rc.conf is a "patch" style delta file, it can contain (and if you've been using '''/stand/sysinstall''', WILL contain) more than one line configuring the same parameter - in which case the last line in the file is the one that takes the final effect.
  
 
So if you open up '''/etc/rc.conf''' and you see the following:
 
So if you open up '''/etc/rc.conf''' and you see the following:

Revision as of 03:22, 24 December 2004

If you want to change the basic network configuration (such as IP address, subnet mask, etc) on your FreeBSD server, there are two basic routes you can take.

The "newbiest" method is to use the text-GUI menu-driven method of hitting up /stand/sysinstall and going through Configure, Networking, Interfaces, and pick the particular network interface you want to configure. This is very simple and easy and will make all the actual changes in the proper system configuration file for you.

The alternate way to do it is to manually edit /etc/rc.conf (and possibly /etc/resolv.conf) yourself. Keep in mind that rc.conf is designed to be a "delta" file; it basically consists of a series of patches to apply to the basic system rc.conf file in /etc/defaults. If you're feeling REALLY leet, you can monkey around in that too (or the rc scripts themselves), but I strongly recommend that you don't - just stick to making your changes in /etc/rc.conf. One thing to remember is that since rc.conf is a "patch" style delta file, it can contain (and if you've been using /stand/sysinstall, WILL contain) more than one line configuring the same parameter - in which case the last line in the file is the one that takes the final effect.

So if you open up /etc/rc.conf and you see the following:

# -- sysinstall generated deltas -- # Fri Jun 11 23:01:12 2004
# Created: Fri Jun 11 23:01:12 2004
# Enable network daemons for user convenience.
# Please make all changes to this file, not to /etc/defaults/rc.conf.
# This file now contains just the overrides from /etc/defaults/rc.conf.
defaultrouter="192.168.90.1"
hostname="ph34r.tehinterweb.net"
ifconfig_bge0="inet 192.168.90.10  netmask 255.255.255.0"
sshd_enable="YES"
usbd_enable="YES"
sendmail_enable="NONE" 

# This file now contains just the overrides from /etc/defaults/rc.conf.
# Please make all changes to this file, not to /etc/defaults/rc.conf. 

# Enable network daemons for user convenience.
# Created: Thu Oct 14 10:29:05 2004
# -- sysinstall generated deltas -- # Thu Oct 14 10:29:05 2004
ifconfig_bge0="inet 192.168.90.50  netmask 255.255.255.0"
defaultrouter="192.168.90.1"
hostname="ph34r.tehinterweb.net"

You should realize that the EFFECTIVE ip address of ph34r, now, will be the latest change visible in the file - 192.168.90.50. The only things that you cannot change in /etc/rc.conf in terms of the basic IP network setup are the internet domain your machine considers itself a member of, and the DNS resolution settings - you change that in /etc/resolv.conf, which is NOT a "delta" or "patch" file, but is a complete config file in its own right, which simply lists available nameservers to use for DNS resolution.

ph34r# cat /etc/resolv.conf
domain  tehinterweb.net
nameserver      192.168.90.10

This one's pretty self-explanatory: the domain is tehinterweb.net, meaning that the FQDN is ph34r.tehinterweb.net since the base server name is ph34r, and it uses the nameserver at 192.168.90.10 (in this case, meaning it uses its own services) to resolve DNS requests. If you wanted to change either of those things, you would edit them. You can also list more than one nameserver to use for DNS resolution, if you like, and it will select as it needs to from the list you have given it.

Personal tools