juniper路由器配置举例2

lab@BJBJ-PS-WAP-RT02> show configuration  
version 8.2R1.7;
system {
    host-name BJBJ-PS-WAP-RT02;   # 设置主机名
    root-authentication {
        encrypted-password "$1$F.5pBqJO$Cc8.y8UfhvY0kFgq/ukw5/"; # 设置root用户密码
    }
    login {
        user lab {              # 设置用户,用户名是lab
            uid 2000;           # 设置lab用户的uid2000
            class super-user;   # 设置lab用户为超级用户 组
            authentication {    # 设置lab用户密码
                encrypted-password "$1$LDamL 8C 0$IOMvGYxO87zPwNvABmfZU."; ## SECRET-DATA
            }
        }
    }
    services {                  # 设置远程访问方式
        ftp;                    # 开放FTP服务
        telnet;                  # 开放telnet服务
    }
    syslog {                    # 设置syslog
        user * {                 # 所有用户都接收emergency级别告警信息
            any emergency;     
        }
host 10.39.245.1 {      # 设置接收syslog服务器
    any warning;        # 接收信息级别
}
        file messages {          #syslog 记录到messages文件中(系统默认日志文件)
            any notice;          # 所有notice级别信息 都记录
            authorization info;  # 授权的info级别信息也记录
        }
source-address 10.0.0 .130 ;  # 在发送给syslog服务器时以哪个地址作为源地址
    }
}
interfaces {
ge-0/0/0 {
        description To-LAN-Switch;    # 连接CMNet端口交换机
        link-mode full-duplex;        # 工作模式是全双工
gigether-options {
            no-auto-negotiation;      # 非协商模式
        }
        unit 0 {   
            family inet {
                address 10.147.67.248/25 {   # 内部局域网本机IP地址
                    vrrp-group 0 {
                        virtual-address 10.147.67.240;  # 内部局域网浮动IP地址
                        priority 120;                   # 本机优先值,值越大越优先
                        fast-interval 100;            #hello 检测间隔时间,100毫秒
                        preempt {                     # 设置为抢占模式
                            hold-time 30;             # 在抢占回来之前先保持30秒钟
                        }
                        accept-data;                  # 让虚拟IP地址接受
                        track {                      #VRRP 端口跟踪
                            interface ge-0/0/1.0 {    # 跟踪外部端口
                                priority-cost 50;     # 如果外部端口down,优 先值减少50
                            }
                        }
                    }
                }
            }
        }
    }
    sp-0/0/0 {
        unit 0 {
            family inet;
        }
    }
ge-0/0/1 {
link-mode full-duplex;        # 工作模式是全双工
gigether-options {
            no-auto-negotiation;      # 非协商模式
        }
        mac 00:00:5e:00:01:01;        # 设置本端口MAC地址,目的是为了跟另外一台相同
        unit 0 {
            family inet {
                service {             # 设置service服务策 略
                    input {           # 流量进入方向
                        service-set nat-service-set;  # 应用NAT服务集合
                    }
                    output {           # 流量进入方向
                        service-set nat-service-set;  # 应用NAT服务集合
                    }
                }
                address 10.4.4 .52/24 {
                    vrrp-group 0 {
                        virtual-address 10.4.4 .50;
                        priority 120;
                        fast-interval 100;
                        preempt {
                            hold-time 30;
                        }
                        accept-data;
                        track {
                            interface ge-0/0/0.0 {
                                priority-cost 50;
                            }
                        }
                    }
                }
            }
        }
    }
}
routing-options {
    static {
        route 10.4.1 .1/32 next-ho p 10.4.4 .254;   # 到短信中心服务器IP地址
        route 10.4.1 .2/32 next-ho p 10.4.4 .254;   # 到短信中心服务器IP地址
        route 10.147.67.64/27 next-hop 10.147.67.254;   # 到短信中心网络
    }
}
services {               # 定义service服务策略
    nat {                # 定义nat策略
        rule nat-output { # 策略名称
            match-direction output;  # 策略应用方向
            term a {                 # 策略条目名称
                from {               # 匹配源地址,如果匹配了,则执行then的动作
                    source-address {
                        10.147.67.134/32;  # 内部IP地 址
                    }
                }
                then {               # 动作定义
                    translated {     # 符合from条件之后就进行地址转换
                        source-prefix 10.4.4 .53/32;     # 外部IP地址
                        translation-type source static; #NAT 方式:静态转换
                    }
                }
            }
            term b {
                from {
                    source-address {
                        10.147.67.135/32;
                    }
                }
                then {
                    translated {
                        source-prefix 10.4.4 .54/32;
                        translation-type source static;
                    }
                }
            }
        }
        rule nat-input {
            match-direction input;
            term a {
                from {
                    destination-address {
                        10.4.4 .53/32;
                    }
                }
                then {
                    translated {
                        destination-prefix 10.147.67.134/32;
                        translation-type destination static;
                    }
                }
            }
            term b {
                from {
                    destination-address {
                        10.4.4 .54/32;
                    }
                }
                then {
                    translated {
                        destination-prefix 10.147.67.135/32;
                        translation-type destination static;
                    }
                }
            }
        }
    }
    service-set nat-service-set {   # 定义service集合
        nat-rules nat-output;       # 应用NAT策略
        nat-rules nat-input;        # 应用NAT策略
        interface-service {         # 服务端口
            service-interface sp-0/0/0;
        }
    }
}
lab@BJBJ-PS-WAP-RT02>

你可能感兴趣的:(职场,路由器,举例,休闲,juniper)