Enable Sendmail in FreeBSD
This can be enabled in the rc.conf file at ‘/etc/rc.conf’.
Check for the following variable “sendmail_enable”.
If set to “NO”, specifies sendmail to only listen on localhost.
Checking netstat result.
$ netstat -na |grep LIST | grep 25
tcp4 0 0 127.0.0.1.25 *.* LISTEN
If set to “YES”, allows remote connections.
If set to “NONE”, disables the sendmail daemon.
Search and install ports in FreeBSD
Ports are the collections of system tools that are used in FreeBSD.
How to search a port?
For example, we need to seach a port for ‘wget’ to install it. Use the following commands to search.
# cd /usr/ports
# make search name=wget | grep Path
How to install a port?
Installing ports is very easy, just execute the command given below. Suppose the path is /usr/ports/www/wget
# cd /usr/ports/www/wget
# make install clean
Or
# make; make install; make clean
GRUB single user mode
To get into the single user mode follow the steps below :
1. At the GRUB boot prompt, select the image to be booted and press e.
2. Select the line containing kernel and press e.
3. At the end of the line specify the runlevel, for single user mode specify 1. So the line looks like,
kernel /vmlinuz-2.6.16.5 ro root=LABEL=/ rhgb quiet 1
4. Press Enter to save the line, and press b to boot the modified image.
5. You will be logged to the single usermode.
6. If you only needed a root shell, in step 3, you may specify
kernel /vmlinuz-2.6.16.5 ro root=LABEL=/ rhgb quiet init=/bin/bash
Enable IPTABLES support in Linux Kernel
You need to recompile kernel to enable IPTABLES support. I am giving the steps to enable IPTABLES support during kernel recompilation.
Get into the kernel source directory:
# cd /usr/local/src/kernel
# make menuconfig
Select the following option (not as a loadable module)
Networking >> Networking options >> Network packet filtering (replaces ipchains) >> Core Netfilter Configuration >> Netfilter Xtables support (required for ip_tables) and select the all following options as modules.
Networking >> Networking options >> Network packet filtering (replaces ipchains) >> IP: Net Filter configurationS >> IP Tables support
# make
# make modules
# make modules_install
# make install
How to redirect port using IPTABLES
You can redirect the port in IPTABLES using the prerouting parameter.
Following is the command you can use to redirect the traffic of port 8080 to port 80.
$ /sbin/iptables -t nat -I PREROUTING -p tcp –dport 8080 -j REDIRECT –to-port 80
$ /etc/init.d/iptables save
$ /etc/init.d/iptables restart
You can change the ports in the above command according to your need.