Ubuntu Server Guide Changes, errors and bugs
Temporary IP Address Assignment
Download 1.27 Mb. Pdf ko'rish
|
ubuntu-server-guide
Temporary IP Address Assignment
For temporary network configurations, you can use the ip command which is also found on most other GNU/Linux operating systems. The ip command allows you to configure settings which take effect immedi- ately, however they are not persistent and will be lost after a reboot. To temporarily configure an IP address, you can use the ip command in the following manner. Modify the IP address and subnet mask to match your network requirements. sudo i p addr add 1 0 . 1 0 2 . 6 6 . 2 0 0 / 2 4 dev enp0s25 The ip can then be used to set the link up or down. i p l i n k s e t dev enp0s25 up i p l i n k s e t dev enp0s25 down To verify the IP address configuration of enp0s25, you can use the ip command in the following manner. i p a d d r e s s show dev enp0s25 1 0 : enp0s25 : group d e f a u l t q l e n 1000 l i n k / e t h e r 0 0 : 1 6 : 3 e : e2 : 5 2 : 4 2 brd f f : f f : f f : f f : f f : f f l i n k −n e t n s i d 0 i n e t 1 0 . 1 0 2 . 6 6 . 2 0 0 / 2 4 brd 1 0 . 1 0 2 . 6 6 . 2 5 5 s c o p e g l o b a l dynamic e t h 0 v a l i d _ l f t 2857 s e c p r e f e r r e d _ l f t 2857 s e c i n e t 6 f e 8 0 : : 2 1 6 : 3 e f f : f e e 2 : 5 2 4 2 / 6 4 s c o p e l i n k v a l i d _ l f t f o r e v e r p r e f e r r e d _ l f t f o r e v e r 6 52 To configure a default gateway, you can use the ip command in the following manner. Modify the default gateway address to match your network requirements. sudo i p r o u t e add d e f a u l t v i a 1 0 . 1 0 2 . 6 6 . 1 To verify your default gateway configuration, you can use the ip command in the following manner. i p r o u t e show d e f a u l t v i a 1 0 . 1 0 2 . 6 6 . 1 dev e t h 0 p r o t o dhcp s r c 1 0 . 1 0 2 . 6 6 . 2 0 0 m e t r i c 100 1 0 . 1 0 2 . 6 6 . 0 / 2 4 dev e t h 0 p r o t o k e r n e l s c o p e l i n k s r c 1 0 . 1 0 2 . 6 6 . 2 0 0 1 0 . 1 0 2 . 6 6 . 1 dev e t h 0 p r o t o dhcp s c o p e l i n k s r c 1 0 . 1 0 2 . 6 6 . 2 0 0 m e t r i c 100 If you require DNS for your temporary network configuration, you can add DNS server IP addresses in the file /etc/resolv .conf. In general, editing /etc/resolv .conf directly is not recommanded, but this is a temporary and non-persistent configuration. The example below shows how to enter two DNS servers to /etc/resolv . conf, which should be changed to servers appropriate for your network. A more lengthy description of the proper persistent way to do DNS client configuration is in a following section. nameserver 8 . 8 . 8 . 8 nameserver 8 . 8 . 4 . 4 If you no longer need this configuration and wish to purge all IP configuration from an interface, you can use the ip command with the flush option as shown below. i p addr f l u s h e t h 0 Note Flushing the IP configuration using the ip command does not clear the contents of /etc/resolv .conf. You must remove or modify those entries manually, or re-boot which should also cause /etc/resolv .conf, which is a symlink to /run/systemd/resolve/stub−resolv.conf, to be re-written. Download 1.27 Mb. Do'stlaringiz bilan baham: |
Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling
ma'muriyatiga murojaat qiling