zoukankan      html  css  js  c++  java
  • freebsd静态路由

    FreeBSD下增进静态路由的行动

    1.手工添加
    # route add -net 192.168.2.0/24 192.168.1.2
    2. 通过rc.conf永世 设置
    # Add static route
    static_routes="net1 net2"
    route_net1="-net 192.168.0.0/24 192.168.0.1"
    route_net2="-net 192.168.1.0/24 192.168.1.1"
    ifconfig_eth0="inet 192.168.1.253 netmask 255.255.255.0"
    defaultrouter="192.168.1.254"

    路由的属性符号 和它们的寄义 的一个简表:
    U    Up: 路由处于活动状况 。
    H    Host: 路由方针 是单个主机。
    G    Gateway: 全部 发到方针地的网络传到这一长途 体系 上, 并由它决议 末了 发到那边。
    S    Static: 这个路由是手工设置 的,不是由体系 主动 天生 的。
    C    Clone: 天生 一个新的路由, 通过这个路由我们可以毗连 上这些机子。 这种范例 的路由通常用于内地 网络。
    W    WasCloned: 指明一个路由——它是基于内地 区 域网络 (克隆) 路由主动 设置 的。
    L    Link: 路由涉及到了以太网硬件。

    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.

    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, . The following command will also update routing information:
    # /etc/rc.d/netif restart
    # /etc/rc.d/netif stop
    # /etc/rc.d/netif start

  • 相关阅读:
    模拟死锁
    B站学习斯坦福大学Swift 语言教程 iOS11 开发【第一集】踩到的几个坑(XCode 13.2.1版本)
    数学之美番外篇:平凡而又神奇的贝叶斯方法
    joj 1753: Street Numbers
    二叉树的三种遍历(递归+非递归)
    joj 1905: Freckles
    joj 2630: A Pair of Graphs(同构图的判定)
    vue3.x 中获取dom元素
    defineProperty 和 Proxy 的区别
    vue 按钮的防抖和节流
  • 原文地址:https://www.cnblogs.com/ruiy/p/router.html
Copyright © 2011-2022 走看看