FreeBSD ifconfig: Difference between revisions

From wikinotes
No edit summary
No edit summary
Line 23: Line 23:
</source>
</source>
</blockquote><!-- Basics -->
</blockquote><!-- Basics -->
= ipv4 =
<blockquote>
<syntaxhighlight lang="bash">
# /etc/rc.conf
hostname="domain.com"
defaultrouter="192.168.1.1"        # gateway
ifconfig_em0="inet 192.168.1.0/24"  # define netwk for iface 'em0'
</syntaxhighlight>
</blockquote><!-- ipv4 -->
= ipv6 =
<blockquote>
{{ NOTE |
untested }}
<syntaxhighlight lang="bash">
# /etc/rc.conf
ifconfig_em0_ipv6="inet6 ..."
ifconfig_em0_alias0="inet6 ..."
ipv6_default_router="..."
ipv6_gateway="..."
</syntaxhighlight>
</blockquote><!-- ipv6 -->

Revision as of 03:18, 7 August 2021

FreeBSD uses ifconfig to manage network interfaces.

Basics

Dynamic

manipulate interfaces within shell.

# create/destroy a network interface of type 'tun'
ifconfig tun  create up
ifconfig tun0 destroy

Persistent

define interfaces to setup at boot.

# /etc/rc.conf

cloned_interfaces="bridge0 brige1"  # space separated virtual interfaces to create
ifconfig_bridge0="inet 10.0.1.1/8"  # assign ip address to bridge0
defaultrouter="192.168.1.1"         # your local nameserver

ipv4

# /etc/rc.conf

hostname="domain.com"
defaultrouter="192.168.1.1"         # gateway
ifconfig_em0="inet 192.168.1.0/24"  # define netwk for iface 'em0'

ipv6

NOTE:

untested

# /etc/rc.conf

ifconfig_em0_ipv6="inet6 ..."
ifconfig_em0_alias0="inet6 ..."
ipv6_default_router="..."
ipv6_gateway="..."