Configuring an IPv4 Address on an Interface

Problem

You want to configure an interface to work on an IPv4 network.

Solution

Use the following command to configure an IPv4 address on an interface:

	[edit]
	aviva@router1# set interfaces fe-0/0/0 unit 0 family inet address 192.168.220.1/24

 

Discussion

For any IPv4 routing protocol such as BGP, OSPF, RIP, and ICMP to work, not only do you have to configure the protocol, but you also have to configure the interfaces on which the protocol can run. You configure the address under the logical interfaces portion. For IPv4 addresses, the address family is inet.

To see that the IPv4 address has been set, you can look at the logical interface:

	aviva@router1> show interfaces fe-0/0/0.0 brief
	Logical interface fe-0/0/0.0
	Flags: SNMP-Traps Encapsulation: ENET2
	inet 192.168.220.1/24

The JUNOS software allows more than one address on a logical interface. Issuing a second set command does not overwrite an existing address, but simply adds the second address. To correct an IP address, use the rename command:

	[edit interfaces fe-0/0/0]
	aviva@router1# rename unit 0 family inet address 192.168.220.1/24 to address 
192.168.220.2/24

To remove an extra IP address, use the delete command:

	[edit interfaces fe-0/0/0]
	aviva@router1# delete unit 0 family inet address 192.168.220.1/24

If you have many interfaces to configure and need to conserve IP addresses, you do not have to assign an address to the logical interface:

	[edit interfaces]
	aviva@router1# set fe-1/0/0 unit 0 family inet

This command creates what is called an unnumbered interface. When packets are sent out this interface, their source address contains the router's default address, which is the address you set on the loopback (lo0) interface. If you have not set an address on lo0, make sure that you have configured an address on another interface on the router.

See Also

Recipes 7.3, 7.4, and 7.12


Router Configuration and File Management

Basic Router Security and Access Control

IPSec

SNMP

Logging

NTP

Router Interfaces

IP Routing

Routing Policy and Firewall Filters

RIP

IS-IS

OSPF

BGP

MPLS

VPNs

IP Multicast



JUNOS Cookbook
Junos Cookbook (Cookbooks (OReilly))
ISBN: 0596100140
EAN: 2147483647
Year: 2007
Pages: 290
Authors: Aviva Garrett

Flylib.com © 2008-2020.
If you may any questions please contact us: flylib@qtcs.net