FreeBSD Cheat Sheet: Difference between revisions
From Leo's Notes
This page was last edited on 9 December 2012, at 19:15.
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
== Mounting ISO Image == | == Mounting ISO Image == | ||
=== Linux === | |||
Mount: | Mount: | ||
mount -o loop -t iso9660 <isofile> <destination> | mount -o loop -t iso9660 <isofile> <destination> | ||
| Line 9: | Line 9: | ||
=== FreeBSD === | |||
Mount: | Mount: | ||
mdconfig -a -f <isofile> md0 | mdconfig -a -f <isofile> md0 | ||
| Line 20: | Line 20: | ||
== Adding IP Alias == | == Adding IP Alias == | ||
=== FreeBSD === | |||
ifconfig re0 10.1.1.2 netmask 255.255.255.255 alias | ifconfig re0 10.1.1.2 netmask 255.255.255.255 alias | ||
| Line 28: | Line 28: | ||
== Set a Gateway (Traffic Forwarder) == | == Set a Gateway (Traffic Forwarder) == | ||
=== Linux === | |||
route add -net 10.10.2.0/24 dev INSIDE | route add -net 10.10.2.0/24 dev INSIDE | ||
echo 1 > /proc/sys/net/ipv4/ip_forward | echo 1 > /proc/sys/net/ipv4/ip_forward | ||
| Line 38: | Line 38: | ||
upgrade from pkgconf | upgrade from pkgconf | ||
portmaster -o devel/pkgconf devel/pkg-config | portmaster -o devel/pkgconf devel/pkg-config | ||
== Restarting Services == | |||
=== Linux === | |||
Use any one of: | |||
/etc/init.d/<service> restart | |||
/etc/init.d/<service> stop && /etc/init.d/<service> start | |||
service <service> restart | |||
=== FreeBSD === | |||
Usually, the startup scripts are located in <code>/etc/rc.d</code> | |||
/etc/rc.d/<service> restart | |||
However, if it is 3rd party software, they are located in <code>/usr/local/etc/rc.d</code> | |||
/usr/local/etc/rc.d/<service> restart | |||
If you are trying to restart NFS, you may do either: | |||
/etc/rc.d/nsfd restart | |||
kill -HUP `cat /var/run/mountd.pid` | |||
=== Solaris / SunOS === | |||
The startup scripts are located in <code>/lib/svc/method/<service></code> | |||
/lib/svc/method/<service> restart | |||
svcadm restart <service> | |||
Example: To restart ssh, do any one of: | |||
svcadm restart ssh | |||
svcadm restart svc:/network/ssh | |||
/lib/svc/method/sshd restart | |||
Revision as of 19:15, 9 December 2012
Mounting ISO Image
Linux
Mount:
mount -o loop -t iso9660 <isofile> <destination>
Unmount:
umount <destination>
FreeBSD
Mount:
mdconfig -a -f <isofile> md0 mount -t cd9660 /dev/md0 <destination>
Unmount:
umount <destination> mdconfig -d -u md0
Adding IP Alias
FreeBSD
ifconfig re0 10.1.1.2 netmask 255.255.255.255 alias
/etc/rc.conf ifconfig_re0_alias0="10.1.1.2 netmask 255.255.255.255 alias"
Set a Gateway (Traffic Forwarder)
Linux
route add -net 10.10.2.0/24 dev INSIDE echo 1 > /proc/sys/net/ipv4/ip_forward iptables -t nat -A POSTROUTING -o eth2 (outside) -j MASQUERADE iptables -A FORWARD -i eth1 -j ACCEPT
Upgrading pkgconfig to pkg-config on FreeBSD
upgrade from pkgconf portmaster -o devel/pkgconf devel/pkg-config
Restarting Services
Linux
Use any one of:
/etc/init.d/<service> restart /etc/init.d/<service> stop && /etc/init.d/<service> start service <service> restart
FreeBSD
Usually, the startup scripts are located in /etc/rc.d
/etc/rc.d/<service> restart
However, if it is 3rd party software, they are located in /usr/local/etc/rc.d
/usr/local/etc/rc.d/<service> restart
If you are trying to restart NFS, you may do either:
/etc/rc.d/nsfd restart kill -HUP `cat /var/run/mountd.pid`
Solaris / SunOS
The startup scripts are located in /lib/svc/method/<service>
/lib/svc/method/<service> restart svcadm restart <service>
Example: To restart ssh, do any one of:
svcadm restart ssh svcadm restart svc:/network/ssh /lib/svc/method/sshd restart