Looking at kernel information

Within the top level of /proc, the files and directories that have actual names contain information about what's going on with the Linux kernel. Here's a partial view:

[donnie@localhost proc]$ ls -l
total 0
. . .
dr-xr-xr-x. 2 root root 0 Oct 19 14:24 acpi
dr-xr-xr-x. 5 root root 0 Oct 19 14:24 asound
-r--r--r--. 1 root root 0 Oct 19 14:26 buddyinfo
dr-xr-xr-x. 4 root root 0 Oct 19 14:24 bus
-r--r--r--. 1 root root 0 Oct 19 14:23 cgroups
-r--r--r--. 1 root root 0 Oct 19 14:23 cmdline
-r--r--r--. 1 root root 0 Oct 19 14:26 consoles
-r--r--r--. 1 root root 0 Oct 19 14:24 cpuinfo
. . .

As with the user-mode stuff, you can use cat to look at some of the different files. For example, here's a partial output of the cpuinfo file:

[donnie@localhost proc]$ cat cpuinfo
processor : 0
vendor_id : AuthenticAMD
cpu family : 16
model : 4
model name : Quad-Core AMD Opteron(tm) Processor 2380
stepping : 2
microcode : 0x1000086
cpu MHz : 2500.038
cache size : 512 KB
physical id : 0
siblings : 1
core id : 0
cpu cores : 1
. . .

Here, you can see the type and speed rating of my CPU, its cache size, and the fact that this CentOS VM is only running on one of the host machine's eight CPU cores. (Doing this on the Fedora host operating system would show information about all eight of the host machine's cores.) 

Yes, you did read that right. I really am using an antique, Opteron-equipped HP workstation from 2009. I got it from eBay for a very cheap price, and it runs beautifully with the LXDE spin of Fedora. And the OpenSUSE machine that you'll see mentioned in other parts of this book is the exact same model and came from the same vendor. (So, now you know just how cheap I really am.)

However, for our present purposes, we don't need to go into the nitty-gritty details of everything that's in /proc. What's more important to our present discussion is the different parameters that can be set from within /proc. For example, within the /proc/sys/net/ipv4 directory, we can see lots of different items that can be tweaked to change IPv4 network performance. Here's a partial listing:

[donnie@localhost ipv4]$ pwd
/proc/sys/net/ipv4
[donnie@localhost ipv4]$ ls -l
total 0
-rw-r--r--. 1 root root 0 Oct 19 16:11 cipso_cache_bucket_size
-rw-r--r--. 1 root root 0 Oct 19 16:11 cipso_cache_enable
-rw-r--r--. 1 root root 0 Oct 19 16:11 cipso_rbm_optfmt
-rw-r--r--. 1 root root 0 Oct 19 16:11 cipso_rbm_strictvalid
dr-xr-xr-x. 1 root root 0 Oct 19 14:23 conf
-rw-r--r--. 1 root root 0 Oct 19 16:11 fib_multipath_hash_policy
-rw-r--r--. 1 root root 0 Oct 19 16:11 fib_multipath_use_neigh
-rw-r--r--. 1 root root 0 Oct 19 16:11 fwmark_reflect
-rw-r--r--. 1 root root 0 Oct 19 16:11 icmp_echo_ignore_all
. . .
. . .

We can use the cat command to view each of these parameters, like so:

[donnie@localhost ipv4]$ cat icmp_echo_ignore_all 
0
[donnie@localhost ipv4]$

So, the icmp_echo_ignore_all parameter is set to 0, which means that it's disabled. If I were to ping this machine from another machine, assuming that the firewall is configured to allow that, this machine would respond to the pings. We have several ways to change that if need be. Some of these are as follows:

  • echo a new value into the parameter from the command line.
  • Use the sysctl utility from the command line.
  • Configure the /etc/sysctl.conf file.
  • Add a new .conf file that contains the new configuration to the /etc/sysctl.d directory.
  • Run a command from within a shell script.

Let's go ahead and look at these different methods in detail.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.126.241