Juniper 静态路由

Juniper <wbr>静态路由

R1最后配置结果

root@R1# exit

[edit]
root@R1# show
## Last changed: 2012-05-22 06:42:46 UTC
version 11.1R1.14;
system {
    host-name R1;
    root-authentication {
        encrypted-password abc123,; ## SECRET-DATA
    }
    syslog {
        user * {
            any emergency;
        }
        file messages {
            any notice;
            authorization info;
        }
        file interactive-commands {
            interactive-commands any;
        }
    }
}
interfaces {
    em0 {
        unit 0 {
            family inet {              
                address 172.16.1.1/24;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet {
                address 1.1.1.1/32;
            }
        }
    }
}
routing-options {
    static {
        route 2.2.2.2/32 next-hop 172.16.1.2;
    }
}

[edit]

R2最后配置结果

root@R2# show
## Last changed: 2012-05-22 07:14:49 UTC
version 10.2R1.8;
system {
    host-name R2;
    root-authentication {
        encrypted-password abc123,; ## SECRET-DATA
    }
    syslog {
        user * {
            any emergency;
        }
        file messages {
            any notice;
            authorization info;
        }
        file interactive-commands {
            interactive-commands any;
        }
    }
}
interfaces {
    em0 {
        unit 0 {
            family inet {              
                address 172.16.1.2/24;
            }
        }
    }
    lo0 {
        unit 0 {
            family inet {
                address 2.2.2.2/32;
            }
        }
    }
}
routing-options {
    static {
        route 1.1.1.0/24 next-hop 172.16.1.1;
    }
}

[edit]

配置过程

环境配置

root@R1> configure
Entering configuration mode

[edit]

root@R1# edit interfaces em0 unit 0 family inet address 172.16.1.1/24

root@R1# edit interfaces lo0 unit 0 family inet address 1.1.1.1/32

root# commit                                                  
commit complete


 

root@R2> configure
Entering configuration mode

[edit]

root@R2# edit interfaces em0 unit 0 family inet address 172.16.1.1/24

root@R2# edit interfaces lo0 unit 0 family inet address 1.1.1.1/32
root# commit                                                  
commit complete

静态路由的配置

root@R1# edit routing-options

[edit routing-options]

root@R1# set static route 2.2.2.2/32 next-hop 172.16.1.1 

root@R1# commit
commit complete

[edit routing-options]

root@R1# show                 
static {
    route 2.2.2.2/32 next-hop [ 172.16.1.2 ];
}

[edit routing-options]

root@R2# edit routing-options

[edit routing-options]
root@R2# set static route 1.1.1.1/32 next-hop 172.16.1.2

[edit routing-options]
root@R2# commit
commit complete

[edit routing-options]

root@R2# show
static {
    route 1.1.1.1/32 next-hop 172.16.1.1;
}

[edit routing-options]

 

测试

root@R1# run ping 2.2.2.2
PING 2.2.2.2 (2.2.2.2): 56 data bytes
64 bytes from 2.2.2.2: icmp_seq=0 ttl=64 time=4.489 ms

root@R2# run ping 1.1.1.1
PING 1.1.1.1 (1.1.1.1): 56 data bytes
64 bytes from 1.1.1.1: icmp_seq=0 ttl=64 time=6.830 ms


 

 

 

 

 

 

 

 

posted on 2012-05-22 15:36  侯志清  阅读(1047)  评论(0编辑  收藏  举报

导航