4-9
Catalyst 2940 Switch Software Configuration Guide
78-15507-02
Chapter4 Assigning the Switch IP Address and Default Gateway Assigning Switch Information
switch2-confg
switch3-confg
switch4-confg
prompt> cat network-confg
ip host switch1 10.0.0.21
ip host switch2 10.0.0.22
ip host switch3 10.0.0.23
ip host switch4 10.0.0.24
DHCP Client Configuration
No configuration file is present on Switch 1 through Switch 4.
Configuration Explanation
In Figure 4-3, Switch 1 reads its configuration file as follows:
It obtains its IP address 10.0.0.21 from the DHCP server.
If no configuration filename is given in the DHCP server reply, Switch 1 reads the network-co nfg
file from the base directory of the TFTP server.
It adds the contents of the network-confg file to its host table.
It reads its host table by indexing its IP address 10.0.0.21 to its host na me ( swit ch1) .
It reads the configuration file that corresponds to its host name; for example, it reads switch1-confg
from the TFTP server.
Switches 2 through 4 retrieve their configuration files and IP addresses in the same way.
Manually Assigning IP Information
Beginning in privileged EXEC mode, follow these steps to manually assign IP information to multiple
switched virtual interfaces (SVIs) or ports:
Command Purpose
Step1 configure terminal Enter global configuration mode.
Step2 interface vlan vlan-id Enter interface configuration mode, and enter the VLAN to which the IP
information is assigned. The range is 1 to1001.
Step3 ip address ip-address subnet-mask Enter the IP address and subnet mask.
Step4 exit Return to global configuration mode.
Step5 ip default-gateway ip-address Enter the IP address of the next-hop router interface t hat is di rec tly
connected to the switch where a default gateway is being configured. The
default gateway receives IP packets with unresolved destination IP
addresses from the switch.
Once the default gateway is configured, the switch has connectivity t o the
remote networks with which a host needs to communicate.
Note When your switch is configured to route with IP, it does not ne ed
to have a default gateway set.
Step6 end Return to privileged EXEC mode.
Step7 show running-config Verify your entries.
Step8 copy running-config startup-config (Optional) Save your entries in the configuration file.