Task: View / Display FreeBSD Routing Table

Use netstat command with -r option:
$ netstat -r
$ netstat -rn

Output:

Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 61.221.xx.yy UGS 0 247 em1
10 10.10.110.5 UGS 0 50 em0
10.10.110/26 link#1 UC 0 0 em0
10.10.110.5 00:1b:0d:e6:58:40 UHLW 2 0 em0 1145
61.221.xx.yy/29 link#2 UC 0 0 em1
61.221.xx.yy 00:1b:0d:e6:57:c0 UHLW 2 0 em1 1055
61.221.xx/24 link#2 UC 0 0 em1
127.0.0.1 127.0.0.1 UH 0 0 lo0

The first two line displays default routes.

To just print IPv4 routing table, enter:
# netstat -4 -r -n

To just print IPv6 routing table, enter:
# netstat -6 -r -n

Task: FreeBSD Set a default route

All network packets that cannot be sent according to the previous entries of the routing table are sent through the following default gateway:
# route add default 192.168.1.254

How do I save routing information to a configuration file?

If you reboot FreeBSD box, the routing configuration will be lost i.e. the routing information will not persist. You need to edit /etc/rc.conf file to set defaultroute:
# vi /etc/rc.conf
Set default route by editing defaultrouter variable:
defaultrouter="192.168.1.254"
Save and close the file.

Task: Start and Stop FreeBSD Configured Interfaces

To apply changes to a configuration file, you need to stop and restart the corresponding FreeBSD networking interface. The following command will also update routing information:
# /etc/rc.d/netif restart
# /etc/rc.d/routing restart

OR
# service netif restart
# service routing restart

How can I change or the default gateway from the FreeBSD CLI?

Use the following commands:
### [ delete the default route/gateway ] ###
# route del default
### [ now setup 192.168.1.254 as the default gateway for my FreeBSD box ] ###
route add default 192.168.1.254

Verify it:
# netstat -r -n

最新文章

  1. webpack那些事儿
  2. javascript 原型及原型链的初步理解
  3. selenium+testng+ant+jenkins 手记
  4. ubuntu死机怎么办
  5. java解析中国行政区域并在页面显示实现动态逐级筛选
  6. C#DateTimePicker控件问题
  7. Activity中使用Intent实现页面跳转与参数的传递(转)
  8. Memcached基础知识
  9. sql server 作业导出放到另外一台机器执行时报错的解决方法
  10. demo_08webStroage案例
  11. underscorejs-sample学习
  12. C语言解析日志,存储数据到伯克利DB
  13. CSS 怀疑 Verify
  14. 编程实现Windows系统自动登录
  15. 【转】python入门指引
  16. 20190318wdVBA_替换下划线
  17. BZOJ.2756.[SCOI2012]奇怪的游戏(二分 黑白染色 最大流ISAP)
  18. 查看修改添加环境变量的工具——Rapid Environment Editor
  19. Spring RedisTemplate操作-哈希操作(3)
  20. Windows开发经验 - WinDbg

热门文章

  1. go-面向对象编程(上)
  2. 合格的施工图是如何绘制的?必须要get这四点,大多数人都不知道
  3. [b0004] Hadoop 版hello word mapreduce wordcount 运行
  4. [20190510]rman备份的疑问7.txt
  5. ORACLE基础之oracle锁(oracle lock mode)详解
  6. Hive SQL编译过程(转)
  7. [视频教程] ubuntu系统下安装最新版PHP7.3.X环境
  8. window系统下的pycharm对虚拟机中的Ubuntu系统操作MySQL数据库
  9. python3.5.3rc1学习五:模块
  10. luoguP3292 [SCOI2016]幸运数字(倍增做法)