Some Linux Network Practices

#1 How do I find out which gateway a Linux system is currently using?

#2 How to check ip forwarding status in centos

#3 How to get information about graphics card (GPU) on Linux

#4 How to display your IP ‘only’


 

#1 How do I find out which gateway a Linux system is currently using?

run route -nee

toosa@toosa-T580:~$ route -nee
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    MSS   Window irtt
0.0.0.0         10.8.0.13       128.0.0.0       UG    0      0        0 tun0     0     0      0
0.0.0.0         192.168.100.1   0.0.0.0         UG    0      0        0 eth0     0     0      0
10.8.0.1        10.8.0.13       255.255.255.255 UGH   0      0        0 tun0     0     0      0
10.8.0.13       0.0.0.0         255.255.255.255 UH    0      0        0 tun0     0     0      0
103.28.22.33    192.168.100.1   255.255.255.255 UGH   0      0        0 eth0     0     0      0
128.0.0.0       10.8.0.13       128.0.0.0       UG    0      0        0 tun0     0     0      0
192.168.100.0   0.0.0.0         255.255.255.0   U     1      0        0 eth0     0     0      0

#2 How to check  ip forwarding status in centos?

[root@server ~]# /sbin/sysctl net.ipv4.ip_forward
net.ipv4.ip_forward = 1

1 - mean ip forwarding is on
0 - mean ip forwarding is off

#3 How to get information about graphics card (GPU) on Linux

toosa@toosa-T580:~$ lspci -vnn | grep VGA -A 12
00:02.0 VGA compatible controller [0300]: Intel Corporation Core Processor Integrated Graphics Controller [8086:0046] (rev 02) (prog-if 00 [VGA controller])
	Subsystem: Fujitsu Limited. Core Processor Integrated Graphics Controller [10cf:150e]
	Flags: bus master, fast devsel, latency 0, IRQ 27
	Memory at f4000000 (64-bit, non-prefetchable) [size=4M]
	Memory at d0000000 (64-bit, prefetchable) [size=256M]
	I/O ports at 1800 [size=8]
	Expansion ROM at <unassigned> [disabled]
	Capabilities: <access denied>
	Kernel driver in use: i915
	Kernel modules: i915

00:16.0 Communication controller [0780]: Intel Corporation 5 Series/3400 Series Chipset HECI Controller [8086:3b64] (rev 06)
	Subsystem: Fujitsu Limited. 5 Series/3400 Series Chipset HECI Controller [10cf:152b]

The first line has the name of the vendor, the model name/series and the pci id. The first part (8086) indicates the vendor id (which is Intel here) and the second number (0046) indicates the pci id, which indicates the model of the graphics unit.

The lshw command can also be used to get the above information

oosa@toosa-T580:~$ sudo lshw -numeric -C display
  *-display               
       description: VGA compatible controller
       product: Core Processor Integrated Graphics Controller [8086:46]
       vendor: Intel Corporation [8086]
       physical id: 2
       bus info: pci@0000:00:02.0
       version: 02
       width: 64 bits
       clock: 33MHz
       capabilities: msi pm vga_controller bus_master cap_list rom
       configuration: driver=i915 latency=0
       resources: irq:27 memory:f4000000-f43fffff memory:d0000000-dfffffff ioport:1800(size=8)

#4 How to display your IP ‘only’

$ ifconfig wlan0 | grep "inet " | awk -F'[: ]+' '{ print $4 }'


192.168.1.2

Leave a Reply

Your email address will not be published.

Captcha Captcha Reload