Network Configuration (basic)
(Undo revision 12241 by 46.4.63.123 (Talk)) |
|||
(6 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
− | 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. | + | 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. You can also do a [[Network Configuration (manual)]] using [[ifconfig]] but if you don't save your settings in the rc.conf file (or have sysinstall save them for you) then they'll go away if your server reboots. |
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 [[rc.conf|/etc/rc.conf]] (and possibly [[etc/resolv.conf|/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: | ||
Line 36: | Line 36: | ||
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. | 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. | ||
+ | |||
+ | '''Advanced Network Configuration''' | ||
+ | |||
+ | More advanced network configuration methods can be found in the [[Network Configuration (Advanced)]] section. | ||
[[Category:Configuring FreeBSD]] | [[Category:Configuring FreeBSD]] | ||
+ | [[Category:FreeBSD for Servers]] |
Latest revision as of 10:31, 20 June 2011
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. You can also do a Network Configuration (manual) using ifconfig but if you don't save your settings in the rc.conf file (or have sysinstall save them for you) then they'll go away if your server reboots.
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.
Advanced Network Configuration
More advanced network configuration methods can be found in the Network Configuration (Advanced) section.