Freebsd networking: Difference between revisions
From wikinotes
No edit summary |
|||
Line 47: | Line 47: | ||
= Examples = | = Examples = | ||
<blockquote> | <blockquote> | ||
== Static | == Static IPV4 == | ||
<blockquote> | |||
<source lang="bash"> | <source lang="bash"> | ||
# /etc/rc.conf | # /etc/rc.conf | ||
Line 64: | Line 65: | ||
ifconfig em0 inet 192.168.0.254 netmask 255.255.255.0 | ifconfig em0 inet 192.168.0.254 netmask 255.255.255.0 | ||
</source> | </source> | ||
</blockquote><!-- Static IPV4 --> | |||
== IP Aliases == | |||
<blockquote> | |||
Assign multiple IP addresses to a network interface.<br> | |||
commonly used for assigning IPs to jails. | |||
<syntaxhighlight lang="bash"> | |||
# /etc/rc.conf | |||
ifconfig_em0_alias0="192.168.1.221/24" | |||
ifconfig_em0_alias1="192.168.1.222/24" | |||
</syntaxhighlight> | |||
</blockquote><!-- IP Aliases --> | |||
</blockquote><!-- Examples --> | </blockquote><!-- Examples --> |
Revision as of 03:33, 7 August 2021
TODO:
this page is horrible. learn, and clean.
Documentation
freebsd handbook: network communication https://docs.freebsd.org/en/books/handbook/partiv/
Locations
/etc/rc.conf
persist network configuration /etc/resolv.conf
DNS config
Tools
FreeBSD ifconfig
Usage
Manual Connection
# Starting a manual network connection from CLI sudo route add default 192.168.1.1 # Set path to your router ifconfig # find interface you want ifconfig em0 up # set interface 'up' dhclient em0 # (equivalent of DHCPCD, requests IP address)
Examples
Static IPV4
# /etc/rc.conf ifconfig_em0="inet 192.168.1.220 netmask 255.255.255.0" defaultrouter="192.168.1.1"# If you still are not able to get outside the internal # network, try deleting and re-adding the default router from CLI route delete default route add default 192.168.1.1 # The following should restart your internet connection. ifconfig em0 inet 192.168.0.254 netmask 255.255.255.0IP Aliases
Assign multiple IP addresses to a network interface.
commonly used for assigning IPs to jails.# /etc/rc.conf ifconfig_em0_alias0="192.168.1.221/24" ifconfig_em0_alias1="192.168.1.222/24"