0% found this document useful (0 votes)
19 views4 pages

Task 5

Uploaded by

Kunal Puri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
19 views4 pages

Task 5

Uploaded by

Kunal Puri
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Task 5

1. What is dmesg?

dmesg is a command in Linux used to display messages from the kernel's


ring buffer. These messages are typically related to hardware initialization,
driver issues, and system errors that occur during boot or runtime.

2. What kind of logs does dmesg display?

dmesg displays kernel logs, which include:

 Boot messages (hardware detection and initialization).

 Driver status and errors.

 Device connection or disconnection events (e.g., USB devices).

 Kernel panics or warnings.

 Memory-related logs.

To view the latest messages:

dmesg | tail

3. What is the purpose of the dig command?

dig (Domain Information Groper) is a network tool used to query Domain


Name System (DNS) servers. It helps resolve domain names into IP
addresses and provides detailed DNS records.

Example:

dig google.com

Common uses:

 Resolve a domain to an IP address (A or AAAA records).

 Retrieve MX (mail exchange) records:

 dig google.com MX

4. How do you check the default gateway of a system?

To find the default gateway, you can use the following commands:
 ip route (Preferred):

 ip route show

Look for the line starting with default (e.g., default via 192.168.1.1).

 route (Legacy):

 route -n

The default gateway appears in the Gateway column next to 0.0.0.0.

5. Which command shows the MAC address of a network


interface?

To view the MAC address of a network interface:

 Using ip addr:

 ip addr show

Look for the link/ether field under the desired interface.

 Using ifconfig:

 ifconfig

The MAC address is displayed as ether.

6. How do you configure a static IP address on a Linux system?

The steps depend on the Linux distribution.

Using nmcli (for NetworkManager-based distros like Ubuntu or


Fedora):

1. Create a new connection with a static IP:

2. nmcli con add type ethernet con-name static-ip ifname <interface-


name> ip4 <ip-address>/<prefix> gw4 <gateway>

Replace <interface-name> (e.g., eth0), <ip-address> (e.g.,


192.168.1.100), <prefix> (e.g., 24), and <gateway> (e.g., 192.168.1.1).

3. Set DNS servers:

4. nmcli con mod static-ip ipv4.dns "<dns1>,<dns2>"

5. Bring up the connection:

6. nmcli con up static-ip


Manual Configuration (e.g., for netplan on Ubuntu):

1. Edit the Netplan configuration file:

2. sudo nano /etc/netplan/01-netcfg.yaml

3. Add the static IP configuration:

4. network:

5. version: 2

6. ethernets:

7. eth0:

8. addresses:

9. - 192.168.1.100/24

10. gateway4: 192.168.1.1

11. nameservers:

12. addresses: [8.8.8.8, 8.8.4.4]

13. Apply the changes:

14. sudo netplan apply

7. How do you list all open ports on your system?

Use one of the following commands:

 netstat (Legacy):

 netstat -tuln

Options:

o -t: TCP connections.

o -u: UDP connections.

o -l: Listening ports.

o -n: Numerical addresses.

 ss (Modern alternative to netstat):

 ss -tuln

 lsof:

 lsof -i -P -n
Lists all open ports along with associated processes.

 nmap (If installed):

 nmap -sT -O localhost

Scans all open TCP ports.

You might also like