Changing Hostname Temporarly
Example: hostname newhostname.comChanging Hostname Permanently
Edit the file /etc/rc.conf and change the value in it, Save and exitChanging/Setting main ip
Edit the file /etc/rc.conf and change the value of ifconfig_ed0 (The interface name can be different)Example rc.conf file:
### Basic network options: ###
hostname="myname.my.domain" # Set this!
network_interfaces="lo0" # List of network interfaces (lo0 is loopback).
You will need to amend this line to tell FreeBSD that you want to add another device, namely the 'ed0' device. Change this line to read:
network_interfaces="lo0 rl0" # List of network interfaces (lo0 is loopback).
Beneath the line that specifies which interfaces should be activated are the lines that specify the actual settings for each interface. In the default /etc/rc.conf file is a single line that says:
ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
#You will need to add another line after that to specify the settings for your 'ed0' device.
#For our sample configuration we will insert a line immediately after the loopback device definition that says:
ifconfig_rl0="inet 2.1.12.5 netmask 255.255.255.0"
Adding more IPs
Add aliases in /etc/rc.conf#More ips will be aliases
ifconfig_rl0_alias0="inet 2.1.12.6 netmask 255.255.255.0"
ifconfig_rl0_alias1="inet 2.1.12.7 netmask 255.255.255.0"
OR Execute below commands
ifconfig rl0 inet 2.1.12.6 netmask 255.255.255.0 alias up
ifconfig rl0 inet 2.1.12.7 netmask 255.255.255.0 alias up
Updating FreeBSD and installing ports
#Some softwares use cvsupcd /usr/ports/net/cvsup-without-gui
make install
#Installing portsnap
pkg_add -r portsnap
mkdir /usr/ports
portsnap fetch
portsnap extract
portsnap update
#Installing apache- It will install perl/python and other dependencies etc automatically
cd /usr/ports/www/apache22
make
make install
#Installing mysql5
cd /usr/ports/databases/mysql50-client
make
make install
cd /usr/ports/databases/mysql50-server
make
make install
#Start scripts are below to start stop them manually
/usr/local/etc/rc.d/apache22.sh
/usr/local/etc/rc.d/mysql-server.sh
# Add the following line to /etc/rc.conf to enable mysql:
# mysql_enable=YES: Set to "NO" by default.
# Set it to "YES" to enable MySQL.
# mysql_limits (bool): Set to "NO" by default.
# Set it to yes to run `limits -e -U mysql`
# just before mysql starts.
# mysql_dbdir (str): Default to "/var/db/mysql"
# Base database directory.
# mysql_args (str): Custom additional arguments to be passed
# to mysqld_safe (default empty).
Firewall Setup
#Load kernel modulekldload ipl
#executing firewall script manually
ipf -Fa -v -f /etc/ipf.rules.script
#Exampl script
#Setup the default allow all rule
pass out from any to any
pass in from any to any
#Allow some ip and your isp ip
pass in quick on rl0 from 4.35.9.0 to 4.35.9.255
#block tcp and icmp traffic for public
block in on rl0 proto tcp from any to any
block in on rl0 proto icmp from any to any
#Allow these for public
pass in on rl0 proto tcp from any to any port = www
pass in on rl0 proto tcp from any to any port = 443
pass in on rl0 proto tcp from any to any port = 21
