开启SSH

允许root登录:

set system services ssh root-login allow  

set system services netconf ssh  

commit and-quit  

修改交换机root登录的密码

  • 设置明文密码:

set system root-authentication plain-text-password

  • 设置密文密码:

set system root-authentication encrypted-password

禁用端口

set interfaces ge-0/0/1 disable

启用端口

delete interfaces ge-0/0/1 disable

设置接口参数

set interfaces ge-0/0/1 description "Connect to Juniper 6350"  #设置端口描述

set interfaces ge-0/0/1 mtu 1500      #设置MTU值范围是(256..9216) 

delete interfaces ge-0/0/1 mtu        #删除设置的MTU值

配置接口IP

set interfaces ge-0/0/1 unit 0 family inet address  192.168.1.1/24

access

set interfaces ge-0/0/10 unit 0 family ethernet-switching interface-mode access

set interfaces ge-0/0/10 unit 0 family ethernet-switching vlan members vlan10

trunk

root# set interfaces ge-0/0/20 unit 0 family ethernet-switching interface-mode trunk

root# set interfaces ge-0/0/20 unit 0 family ethernet-switching vlan members all

修改端口为L2模式

如果将交换机端口设置为二层模式,就可以配置交换机为vlan端口或者Trunk端口

delete interfaces ge-0/0/1 unit 0 family inet    #删除端口三层信息

set interfaces ge-0/0/1 unit 0 family ethernet-switching  #设置为二层端口

修改端口为L3模式

设置为三层模式,就可以当路由器三层端口一样使用,可以配置IP地址

delete interfaces ge-0/0/1 unit 0 family ethernet-switching   #删除二层信息

set interfaces ge-0/0/1 unit 0 family inet    #设置为三层端口

注:

delete interfaces ge-0/0/1 unit 0  #删除端口二层、三层信息

ae

EX交换机最多支持64个聚合端口,每个聚合端口可以捆绑8条物理链路

使用set chassis aggregated-devices ethernet device-count  N命令之后,系统会产生N个名字为ae0到aeN-1的聚合端口

产生ae聚合端口之后,就可以将多个物理端口使用802.3ad协议绑定到指定的ae端口

set chassis aggregated-devices ethernet device-count 2        

set interfaces xe-0/2/0 ether-options 802.3ad ae0                 

set interfaces xe-0/2/1 ether-options 802.3ad ae0    

set interfaces ae0 aggregated-ether-options lacp active

注:

xe-0/2/0 指的是堆叠中的member 0的2号插槽的0号端口

vlan

EX交换机除了具有二层VLAN功能之外,还具有三层VLAN路由功能。

EX交换机会有一个名字为vlan的三层逻辑端口,这个三层逻辑端口可以划分多个逻辑unit单元,unit号范围是(0..16385),而每个逻辑unit单元可以配置IP地址然后跟一个VLAN绑定,实际上unit 单元号和VLAN号没有对应关系,但是为了维护方便,我们建议在实际应用中unit单元号和vlan号配置相同(如下面的vlan.10中的10是unit单元号,它实际上可以跟VLAN 20绑定,但是在实际中最好将它和vlan 10绑定),这样在EX上就可以配置不同VLAN的网关地址了。

set vlans vlan10 vlan-id 10 description vlan-10

set vlans vlan10 mac-table-aging-time 600    #设置mac生存时间(秒),范围是(60-1000000) 

set vlans vlan10 l3-interface irb.10   #绑定三层逻辑子端口

创建三层逻辑子端口

set interfaces irb unit 10 family inet address 192.168.10.254/24

set interfaces irb.10 family inet address 192.168.10.254/24

删除vlan

删除vlan前需要先删除vlan下的所有物理接口以及vlan的三层逻辑接口,vlan才能删除成功

delete interfaces ge-0/0/1  unit 0 family ethernet-switching port-mode access

delete interfaces ge-0/0/1 unit 0 family ethernet-switching vlan members 10

delete interfaces ge-0/0/2  unit 0 family ethernet-switching port-mode access

delete interfaces ge-0/0/2 unit 0 family ethernet-switching vlan members 10

delete interfaces irb unit 10

delete vlans vlan10

堆叠

set virtual-chassis preprovisioned  

set virtual-chassis no-split-detection    

set virtual-chassis member 0 role routing-engine  

set virtual-chassis member 0 serial-number ZD4322130262

set virtual-chassis member 1 role routing-engine  

set virtual-chassis member 1 serial-number ZD4322130182

光堆叠

相比用堆叠线缆进行堆叠,多出来的一个步骤为

指定某两个光口作为堆叠口,这样在这个光口上插上的光纤就可以作为堆叠线缆使用了

光口板卡插上,先指定某个光口为堆叠口

root> request virtual-chassis vc-port set pic-slot 2 port 0 member 0     ----->  2号插槽,0号端口,member号为0

root> request virtual-chassis vc-port set pic-slot 2 port 0 member 1 

指定完后在member 0上进行常规的堆叠配置,绑定member成员

root# set virtual-chassis preprovisioned  

root# set virtual-chassis no-split-detection    

root# set virtual-chassis member 0 role routing-engine  

root# set virtual-chassis member 0 serial-number ZD4322130262

root# set virtual-chassis member 1 role routing-engine  

root# set virtual-chassis member 1 serial-number ZD4322130182

绑定完成后,光纤插上,光堆叠完成

静态路由

set routing-options static route 0.0.0.0/0 next-hop 10.0.0.2

set routing-options static route 100.0.0.0/24 next-hop 12.12.12.2 preference 100      #指定优先级

set routing-options static route 100.0.0.0/24 next-hop 12.12.12.2 tag 2000      #路由打标

set routing-options static route 100.0.0.0/24 next-hop 12.12.12.2 resolve       #juniper设备默认不进行递归查找,如果需要递归则在后面加上resolve命令

set routing-options static route 100.0.0.0/24 next-hop 12.12.12.2 passive      #将不活跃的路由仍旧装入路由表与cisco ip route x.x.x.x x.x.x.x x.x.x.x active一致

set routing-options static route 200.0.0.0/24 discard     #与cisco的null 0路由效果一样

set routing-options static route 0.0.0.0/0 next-hop 10.1.1.1  preference 100     #设置主用路由优先值为100

set routing-options static route 0.0.0.0/0 qualified-next-hop 20.1.1.1 preference 200        #设置备份路由优先值为200,注意只能用qualified-next-hop指定下一跳地址

set routing-options static route 0.0.0.0/0 qualified-next-hop 20.1.1.1 interface ge-0/0/1.0      #指定静态路由下一跳端口

router-id

set routing-options router-id 1.1.1.1

OSPF

set protocols ospf area 0 interface et-0/0/8 interface-type p2p        #指定运行area 0接口的类型

set protocols ospf area 0 interface et-0/0/8 metric 10        #指定运行area 0接口的metric值

set protocols ospf area 0 interface et-0/0/8 authentication md5 1 key xxxxx      #指定基于接口的邻居建立认证

set protocols ospf area 0 interface et-0/0/8 passive     #指定被动接口

set protocols ospf area 0.0.0.0 interface fe-0/0/1 bfd-liveness-detection minimum-interval 300      #指定最小传输和接收间隔

set protocols ospf area 0.0.0.0 interface fe-0/0/1 bfd-liveness-detection multiplier 4      #配置导致始发接口声明关闭的未错过的 hello 数据包的数量

set protocols ospf area 0.0.0.0 interface fe-0/0/1 bfd-liveness-detection full-neighbors-only     #仅为具有全邻接的 OSPF 邻接方配置 BFD 会话

路由策略

基于策略来控制路由信息的引入、发布和接受

基于控制平面,为路由协议和路由表服务

与路由协议结合完成策略

  • 路由策略匹配条件:

匹配路由,可以包括两个语句, from 和 to ,用于定义匹配条件。

在 from 语句中,定义传入路由匹配的标准,可以指定一个或多个匹配条件,如果指定多个路由,则它们都必须与路由匹配条件进行匹配。

语句 from 是可选的,如果省略 from 和 to 语句,则所有路由都被视为匹配。

在 to 语句中,定义传出路由匹配的标准,可以指定一个或多个匹配条件,如果指定多个路由,则它们都必须与路由匹配条件进行匹配。

  • 路由策略操作:

对匹配的路由进行操作,修改属性等。

可以具有一种或多种操作类型,在语句下 then 配置。

set policy-options policy-statement aaa term 1 from protocol bgp       #匹配bgp路由

set policy-options policy-statement aaa term 1 then metric 100     #设置metric值

set policy-options policy-statement aaa term 1 then tag 100      #打上tag标记

set policy-options policy-statement aaa term 1 then accept        #指定如果之前的条件匹配,将接受路由

set policy-options policy-statement bbb term 1 from protocol ospf      #匹配ospf路由

set policy-options policy-statement bbb term 1 from tag 200      #打上tag标记

set policy-options policy-statement bbb term 1 then reject       #指定如果之前的条件匹配,将拒绝路由

  • 导入和导出

junos import or export actions are best understood from a what happens to the routing instance (or routing table).

(junos的导入或导出操作最好从发生在路由实例(或路由表)上的情况来理解。)

Import / Export keywords mean:

import routes from a protocol to the routing instance. Protocol import choices include, but are not limited to: local, direct, static, isis, ospf, or bgp.

(从一个协议中导入路由到路由实例中。协议导入的选择包括但不限于:本地、直接、静态、isis、ospf或bgp。)

export routes from a routing instance into a routing protocol (this is similar to redistributing routes in an IOS product)

(从路由实例导出路由到一个路由协议(这类似于IOS产品中的路由重分配))

示例1:

what is this policy doing?

set policy-options policy-statement POLICY-STATIC term TERM-STATIC from protocol static

set policy-options policy-statement POLICY-STATIC term TERM-STATIC then accept

set protocols ospf export POLICY-STATIC

The first two lines above match against any static route in this routing instance, and then export those routes into this ospf instance. Unless you tell junos otherwise, exporting into ospf defaults to OSPF External Type-2 routes with a metric of 0.

(上面的前两行与这个路由实例中的任何静态路由相匹配,然后将这些路由导出到这个ospf实例中。除非你告诉junos,否则导出到ospf的路由默认为公制为0的OSPF外部Type-2路由。)

示例2:

set protocols ospf export aaa        #将aaa策略匹配的bgp路由导出(重分发)到ospf实例中,导出的同时依据策略去修改bgp路由的metric值,打标记等

set protocols ospf import bbb       # 将bbb策略匹配的ospf路由导入到本地的ospf路由表中,但是由于action是reject,所以这里的意思是指本地ospf路由表拒绝接收aaa策略匹配的ospf路由

示例3:

ospf引入静态路由和直连路由配置

set policy-options policy-statement ospf_red term 1 from protocol static

set policy-options policy-statement ospf_red term 1 from protocol direct

set policy-options policy-statement ospf_red term 1 then accept

set protocols ospf export ospf_red

示例4:

ospf引入默认路由

set policy-options policy-statement ospf_default term 1 from route-filter 0.0.0.0/0 exact

set policy-options policy-statement ospf_default term 1 then accept

set protocols ospf export ospf_default

策略路由

基于策略控制报文的转发,即可以不按照路由表转发报文,而是按照指定的策略需要转发报文,转发失败后再查找路由表转发报文

基于转发平面,为转发策略服务

需要手工逐跳配置,以保证报文按策略转发

ACL(firewall filter)

对于应用于端口或 VLAN 的防火墙过滤器,请指定用于过滤第 2 层(以太网)数据包和第 3 层 (IP) 数据包的家族地址类型 ethernet-switching 

set family ethernet-switching

对于应用于第 3 层(路由)接口的防火墙过滤器:

  • 要过滤 IPv4 数据包,请指定家族地址类型 inet

set family inet

  • 要过滤 IPv6 数据包,请指定家族地址类型 inet6

set family inet6

注: 

可以在同一第 3 层接口上为 IPv4 和 IPv6 流量配置防火墙过滤器。

示例1:

set firewall family inet filter aaa term bbb from protocol ospf        #filter aaa 匹配ospf数据包

set firewall family inet filter aaa term bbb then count bbb      #对ospf数据包进行计数

set firewall family inet filter aaa term bbb then accept

示例2: 

set firewall family inet filter acl10 term 1 from source-address 211.162.228.255/32

set firewall family inet filter acl10 term 1 then discard

set firewall family inet filter acl10 term 2 from source-address 212.162.228.255/32

set firewall family inet filter acl10 term 2 then discard

set firewall family inet filter acl10 term last then accept(隐含拒绝,需要最后写一条accept配置)

set interfaces ge-0/0/0.0 family inet filter input acl10(应用到接口进方向)

set interfaces ge-0/0/0.0 family inet filter output acl10(应用到接口出方向)

注:

每个接口的每个方向只能应用一个防火墙过滤器

BGP

建立 BGP 对等方后, 非 BGP 路由不会由 BGP 对等方自动播发。

在每台支持 BGP 的设备上,都需要策略配置,以便将本地、静态或 IGP 学习的路由导出到 BGP RIB 中,然后将它们作为 BGP 路由播发至其他对等方。

默认情况下,BGP 的播发策略不会向对等方播发任何非 BGP 路由(如本地路由)。

注: 

在 SRX 系列设备上,必须在指定的接口或区域的所有接口上启用预期的主机入站流量。否则,默认情况下会丢弃发往此设备的入站流量。

例如,要允许 SRX 系列设备的特定区域上的 BGP 流量,请使用以下步骤:

set security zones security-zone trust host-inbound-traffic protocols bgp

  • 通过直连接口建立EBGP邻居:

图 2 显示了具有 BGP 对等会话的网络。在示例网络中,AS 17 中的设备 E 具有与一组名为 external-peers的对等方的 BGP 对等方会话。对等方 A、B 和 C 驻留在 AS 22 中,IP 地址为 10.10.10.2、10.10.10.6 和 10.10.10。对等方 D 位于 AS 79,IP 地址为 10.21.7.2。

juniper configuration case_juniper

此示例显示了设备 E 上的配置。

给直连接口配置IP地址:

user@E# set interfaces ge-1/2/0 unit 0 description to-A  

user@E# set interfaces ge-1/2/0 unit 0 family inet address 10.10.10.1/30  

user@E# set interfaces ge-0/0/1 unit 5 description to-B  

user@E# set interfaces ge-0/0/1 unit 5 family inet address 10.10.10.5/30  

user@E# set interfaces ge-0/1/0 unit 9 description to-C  

user@E# set interfaces ge-0/1/0 unit 9 family inet address 10.10.10.9/30  

user@E# set interfaces ge-1/2/1 unit 21 description to-D  

user@E# set interfaces ge-1/2/1 unit 21 family inet address 10.21.7.1/30

设置local AS:

user@E# set routing-options autonomous-system 17

为peer A,B,C创建BGP组,并添加外部邻接方直连接口IP地址:

user@E# set protocols bgp group external-peers neighbor 10.10.10.2  

user@E# set protocols bgp group external-peers neighbor 10.10.10.6  

user@E# set protocols bgp group external-peers neighbor 10.10.10.10

设置邻接方(BGP组)AS:

set protocols bgp group external-peers peer-as 22

添加peer D,并为单个邻接方D设置AS:

user@E# set protocols bgp group external-peers neighbor 10.21.7.2 peer-as 79

邻接方配置将覆盖组配置。

因此,虽然为组中的所有其他邻接方设置peer-as 22,但peer-as 79设置为邻接方 10.21.7.2。

设置对等类型为EBGP:

user@E# set protocols bgp group external-peers type external

输入show protocols命令以验证:

[edit]
user@E# show protocols
bgp {
    group external-peers {
        type external;
        peer-as 22;
        neighbor 10.10.10.2;
        neighbor 10.10.10.6;
        neighbor 10.10.10.10;
        neighbor 10.21.7.2 {
            peer-as 79;
        }
    }
}
  • 通过环回接口建立IBGP邻居:

图 5 显示了具有内部对等会话的典型网络。在示例网络中,AS 17 中的设备在组中 internal-peers全网状。这些设备的环路地址为 192.168.6.5、192.163.6.4 和 192.168.40.4。

juniper configuration case_juniper_02

此示例显示了设备 A 上的配置。

给直连接口和环回接口配置IP地址:

user@A# set interfaces ge-0/1/0 unit 1 description to-B

user@A# set interfaces ge-0/1/0 unit 1 family inet address 10.10.10.1/30

user@A# set interfaces lo0 unit 1 family inet address 192.168.6.5/32

配置IBGP:

user@A# set protocols bgp group internal-peers type internal

user@A# set protocols bgp group internal-peers description “connections to B and C”

user@A# set protocols bgp group internal-peers local-address 192.168.6.5

user@A# set protocols bgp group internal-peers export send-direct

user@A# set protocols bgp group internal-peers neighbor 192.163.6.4

user@A# set protocols bgp group internal-peers neighbor 192.168.40.4

配置OSPF:

user@A# set protocols ospf area 0.0.0.0 interface lo0.1 passive

user@A# set protocols ospf area 0.0.0.0 interface ge-0/1/0.1

配置接受直连路由的策略:

user@A# set policy-options policy-statement send-direct term 2 from protocol direct

user@A# set policy-options policy-statement send-direct term 2 then accept

配置路由器ID和AS:

user@A# set routing-options router-id 192.168.6.5

user@A# set routing-options autonomous-system 17

输入show protocols命令以验证:

user@A# show protocols
bgp {
    group internal-peers {
        type internal;
        description “connections to B and C”;
        local-address 192.168.6.5;
        export send-direct;
        neighbor 192.163.6.4;
        neighbor 192.168.40.4;
    }
}
ospf {
    area 0.0.0.0 {
        interface lo0.1 {
            passive;
        }
        interface ge-0/1/0.1;
    }
}

设备B的配置如下:

set interfaces ge-0/1/0 unit 2 description to-A
set interfaces ge-0/1/0 unit 2 family inet address 10.10.10.2/30
set interfaces ge-0/1/1 unit 5 description to-C
set interfaces ge-0/1/1 unit 5 family inet address 10.10.10.5/30
set interfaces lo0 unit 2 family inet address 192.163.6.4/32
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers description “connections to A and C”
set protocols bgp group internal-peers local-address 192.163.6.4
set protocols bgp group internal-peers export send-direct
set protocols bgp group internal-peers neighbor 192.168.40.4
set protocols bgp group internal-peers neighbor 192.168.6.5
set protocols ospf area 0.0.0.0 interface lo0.2 passive
set protocols ospf area 0.0.0.0 interface ge-0/1/0.2
set protocols ospf area 0.0.0.0 interface ge-0/1/1.5
set policy-options policy-statement send-direct term 2 from protocol direct
set policy-options policy-statement send-direct term 2 then accept
set routing-options router-id 192.163.6.4
set routing-options autonomous-system 17

设备C的配置如下:

set interfaces ge-0/1/0 unit 6 description to-B
set interfaces ge-0/1/0 unit 6 family inet address 10.10.10.6/30
set interfaces lo0 unit 3 family inet address 192.168.40.4/32
set protocols bgp group internal-peers type internal
set protocols bgp group internal-peers description “connections to A and B”
set protocols bgp group internal-peers local-address 192.168.40.4
set protocols bgp group internal-peers export send-direct
set protocols bgp group internal-peers neighbor 192.163.6.4
set protocols bgp group internal-peers neighbor 192.168.6.5
set protocols ospf area 0.0.0.0 interface lo0.3 passive
set protocols ospf area 0.0.0.0 interface ge-0/1/0.6
set policy-options policy-statement send-direct term 2 from protocol direct
set policy-options policy-statement send-direct term 2 then accept
set routing-options router-id 192.168.40.4
set routing-options autonomous-system 17

syslog

set system syslog user * any emergency

set system syslog host x.x.x.x any any       #x.x.x.x为日志服务器

set system syslog file messages any notice

set system syslog file messages authorization info

set system syslog file interactive-commands interactive-commands any

SNMP

可以使用 SNMP 存储基本管理详细信息,如联系人名称和设备的位置。然后,当对问题进行故障排除或执行审计时,管理系统可以远程检索这些信息。

  • 在运行 Junos OS 的设备上配置系统联系人:

user@host# set snmp contact "Enterprise Support, (650) 555-1234"

  • 为运行 Junos OS 的设备配置系统位置:

user@host# set snmp location "London Corporate Office, Lab 5, Row 11, Rack C"

  • 在运行 Junos OS 的设备上配置系统说明:

user@host# set snmp description "M10i router with 8 FPCs"

  • 配置 SNMP 社区字符串:

SNMP 社区字符串定义 SNMP 服务器系统和客户端系统之间的关系。此字符串的作用类似于密码,可控制客户端对服务器的访问。社区字符串是管理名称,用于将设备集合及其上运行的代理组合到一个公共管理域中。

创建只读 SNMP 社区:

user@host# set snmp community public

定义社区的授权级别:

社区的默认授权级别为 read-only

user@host# set snmp community public authorization read-only

定义社区中有权与 Junos OS 中的 SNMP 代理通信的客户端列表:

通常,列表包括您网络中的 SNMP 网络管理系统或管理网络的地址。

user@host# set snmp community public clients 192.168.1.0/24

创建 SNMP 读写社区:

user@host# set snmp community private

定义社区的授权级别:

user@host# set snmp community private authorization read-write

定义社区中有权在 Junos OS 中对 SNMP 代理进行更改的客户端列表:

user@host# set snmp community private clients 192.168.1.0/24

  • 配置 SNMP 陷阱:

陷阱是从 SNMP 代理发送到远程网络管理系统或陷阱接收器的未经请求的消息。除了系统日志记录之外,许多企业还使用 SNMP 陷阱作为故障监控解决方案的一部分。在 Junos OS 中,SNMP 陷阱默认不会转发,因此如果希望使用 SNMP 陷阱,则必须配置一个陷阱组。

可以创建一组一个或多个 SNMP 陷阱并命名,然后定义哪些系统接收这组 SNMP 陷阱。陷阱组的名称作为一个称为社区名称的变量绑定 (varbind) 嵌入在 SNMP 陷阱通知数据包中。

创建一个统一的源地址,使 Junos OS 适用于设备中的所有传出陷阱:

(源地址很有用,因为尽管大多数 Junos OS 设备都有许多出站接口,但使用一个源地址有助于远程 NMS 将陷阱的来源与单个设备相关联。)

user@host# set snmp trap-options source-address x.x.x.x

LLDP

链路层发现协议 (LLDP) 是一种不受供应商制约的行业标准方法,允许网络设备将功能、身份和其他信息播发到 LAN 上。它还为功能发现、网络策略、以太网供电 (PoE) 和库存管理提供了额外的类型、长度和值 (TLV)。

设备使用 LLDP 来学习和分发网络链路上的设备信息。设备使用此信息快速识别各种设备。这种快速识别可确保 LAN 能够顺畅高效地互操作。

支持 LLDP 的设备将类型、长度和值 (TLV) 信息传输到邻接设备。设备信息可以包括详细信息,例如机箱标识、端口标识、系统名称和系统功能。

设备支持以下基本 TLV:
• Chassis Identifier- 与本地系统关联的 MAC 地址。
• Port Identifier-本地系统中指定端口的端口标识。
• Port Description-用户配置的端口说明。端口说明最多可为 256 个字符。
• System Name- 本地系统的用户配置名称。系统名称最多可为 256 个字符。
• System Description-系统说明,其中包含有关在系统上运行的软件和当前映像的信息。此信息是从软件中获取的。您无法配置此信息。
• System Capabilities- 由系统执行的主要功能,例如桥接或路由器。此信息无法配置,但基于产品型号。
• Management Address-本地系统的 IP 管理地址。

设备支持以下 802.3 TLV:
• Power via MDI— 播发介质相关接口 (MDI) 电源支持、电源设备 (PSE) 电源对和电源等级信息的TLV。
• MAC/PHY Configuration Status-播发有关物理接口信息的TLV,例如自动协商状态和支持以及 MAU 类型。此信息基于物理接口结构。您无法配置此信息。
• Link Aggregation-播发端口是否聚合及其聚合端口 ID 的TLV。
• Maximum Frame Size— 一个TLV,用于播发发送 LLDP 帧的接口的最大传输单元 (MTU)。
• Port VLAN—播发接口上配置的 VLAN 名称的TLV。

set protocols lldp port-id-subtype interface-name       #configure the port ID type, length, and value (TLV).(interface-name—Use the interface name to generate the port ID TLV.)(Default: Use the SNMP index of the interface to generate the port ID TLV. This is the default option used to generate port ID TLV.)

set protocols lldp port-description-type interface-alias       #configure the value to be used for port description TLV(interface-alias—Use the ifAlias MIB object value to generate the port description TLV.)

set protocols lldp interface all         #在所有接口上配置 LLDP

set protocols lldp-med interface all        #在所有接口上配置LLDP-MED(LLDP-MED is an extension of LLDP. The device uses LLDP-MED to support device discovery of VoIP telephones and to create location databases for these telephone locations for emergency services. )

DHCP

  • 配置本地dhcp服务器:

set system services dhcp-local-server group dhcp-group-1 interface irb.40     #建立一个本地服务器组dhcp-group-1,并在组内的入口接口 irb.40 上启用 DHCP 本地服务器

set access address-assignment pool vlan40 family inet network 100.64.40.0/24     #DHCP本地服务器宣告的网段

set access address-assignment pool vlan40 family inet range r1 low 100.64.40.10      #可供分配的地址的底范围

set access address-assignment pool vlan40 family inet range r1 high 100.64.40.254     #可供分配的地址的高范围

set access address-assignment pool vlan40 family inet dhcp-attributes maximum-lease-time 7200     #可供分配的地址租期

set access address-assignment pool vlan40 family inet dhcp-attributes name-server 114.114.114.114      #可供分配的地址的DNS

set access address-assignment pool vlan40 family inet dhcp-attributes router 100.64.40.1    #可供分配的地址的网关

set access address-assignment pool vlan40 family inet dhcp-attributes option 60 string AP      #标识下连终端类型

set access address-assignment pool vlan40 family inet dhcp-attributes option 43 ip-address 100.64.40.253     #AC的地址

  • 扩展 DHCP 本地服务器的全局跟踪操作:

set system processes dhcp-service traceoptions file dhcp_logfile         #接收跟踪操作输出的文件名称。所有文件都放在目录/var/log中。

set system processes dhcp-service traceoptions file size 10m     #追踪文件的大小

set system processes dhcp-service traceoptions level all      #要执行的跟踪级别;又称为严重性级别(all—匹配所有级别的消息)

set system processes dhcp-service traceoptions flag all     #跟踪操作以执行(all-追踪所有事件)

  • 扩展的 DHCP 中继代理进程:

set forwarding-options dhcp-relay server-group dhcp x.x.x.x      #x.x.x.x为DHCP服务器

set forwarding-options dhcp-relay active-server-group dhcp      #active DHCP服务器

set forwarding-options dhcp-relay group dhcp interface irb.10     #将接口加入DHCP服务器中,当交换机收到来着该接口的流量后就可以把广播包转为单播包发给DHCP服务器

IGMP SNOOPING

在很多情况下,组播报文要不可避免地经过一些二层交换设备,尤其是在局域网环境里。如图10-1所示,在组播用户和三层组播设备Router之间,组播报文要经过二层交换机Switch。

juniper configuration case_juniper_03

当Router将组播报文转发至Switch以后,Switch负责将组播报文转发给组播用户。由于组播报文的目的地址为组播组地址,在二层设备上是学习不到这一类MAC表项的,因此组播报文就会在所有接口进行广播,和它在同一广播域内的组播成员和非组播成员都能收到组播报文。这样不但浪费了网络带宽,而且影响了网络信息安全。

IGMP Snooping有效地解决了这个问题。配置IGMP Snooping后,二层组播设备可以侦听和分析组播用户和上游路由器之间的IGMP报文,根据这些信息建立二层组播转发表项,控制组播数据报文转发。这样就防止了组播数据在二层网络中的广播。

set protocols igmp-snooping vlan all/default/vlan-name/disable

端口镜像

抓包分析

set forwarding-options analyzer monitor input ingress interface all      #input 被抓取端口;ingress 入方向

set forwarding-options analyzer monitor input egress interface all       #egress 出方向

set forwarding-options analyzer monitor output interface ge-0/0/24.0    #output 分析端口

sFlow

sFlow(Sampled Flow)是一种基于报文采样的网络流量监控技术,主要用于网络流量的统计分析。sFlow提供基于接口的流量分析,可以实时监控流量状况,及时发现异常流量以及入侵流量的源头,为企业用户的日常巡检维护提供了极大的方便。

如下图所示,只需要在支持sFlow Agent的设备上进行部署,远端连接一个sFlow Collector,就可以对流量进行基于接口的搜集和详细的分析。

juniper configuration case_juniper_04

参考 https://info.support.huawei.com/info-finder/encyclopedia/zh/sFlow.html

配置 sFlow 技术:

  1. 配置collector的IP和UDP端口:

user@switch# set protocols sflow collector 10.204.32.46 udp-port 6343

注:

最多可以配置4个collector

  1. 在特定接口上启用sFlow技术:

user@switch# set protocols sflow interfaces ge-0/0/0

注:

无法在三层VLAN逻辑接口启用sFlow技术,无法在聚合口LAG启用sFlow技术,但是可以在LAG成员接口上启用sFlow技术

  1. 指定sFlow代理轮询接口的频率(秒):

user@switch# set protocols sflow polling-interval 20

  1. 指定入/出口数据包采样的速率:

user@switch# set protocols sflow sample-rate ingress/egress 1000

注: 

建议在线卡上的所有端口上配置相同的采样速率。如果配置不同的采样速率不同,则所有端口均使用最低值。仍然可以在不同的线卡上配置不同的速率。

---------------------------------------------------------------------------------------------------------------------------------------------------------待更新

参考 https://www.cnblogs.com/lifei888/articles/16620467.html