Lab 3 Configuring the kernel

Goal: Develop skills tuning the /proc filesystem.

Gain some experience working with device special files and modules.

Use the tools available to explore hardware resources.

Estimated Duration: 45 minutes

Sequence 1: Turning off ping responses

Scenario: You want to reduce the exposure of a critical system. One of your strategies is to “hide” it from easy discovery by ICMP ECHO requests.

Deliverable: A system that does not respond to ping.

Instructions:

1. Configure your system, so that it does not respond to any ping request. This configuration should survive a reboot.

Hint: Install the kernel-doc package and check the kernel documentation on /usr/share/doc/kernel-doc-2.6.18/Documentation/networking/ipsysctl.txt.

a. Check the present value of /proc/sys/net/ipv4/icmp_echo_ignore_all

# cat /proc/sys/net/ipv4/icmp_echo_ignore_all

It should be currently set to zero which means your system will respond normally to pings.

b. Change the value of /proc/sys/net/ipv4/icmp_echo_ignore_all to a 1 which will prevent other hosts from successfully pinging your host while not affecting your ability to ping them. Verify your work.

# echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_all
# cat /proc/sys/net/ipv4/icmp_echo_ignore_all

c. Now test pinging server1.example.com. Pressing Ctrl-C will stop the ping command and display some statistics for you. You should have been able to ping server1.

d. Next have someone else try pinging your station. They should not receive any responses back from your system. Alternatively, try to ping your own network address. This should not work either.

e. Now reboot your system and try to ping your station again. What happened? Why?

f. Remember that changes to the /proc filesystem are temporary and if you want them to persist across reboots you need to put an entry in /etc/sysctl.conf. Edit /etc/sysctl.conf and put the following line at the bottom:

net.ipv4.icmp_echo_ignore_all=1

g. To activate this change run:

# sysctl -p

h. Check the value in /proc. If it is not set to a 1 then recheck the previous two steps. Next reboot your system and check the value in /proc again.

2. MANDATORY CLEANUP

a. Comment out or remove net.ipv4.icmp_echo_ignore_all=1 from /etc/sysctl.conf

b. Remember that changing this file does not affect the system's current configuration, so you will want to undo your change directly as well:

# echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_all
# cat /proc/sys/net/ipv4/icmp_echo_ignore_all

This is to prevent other things from breaking during the week and help preserve your and your instructor's sanity.

Optional Sequence 2: Creating a file persistently under /dev/

Scenario: You want to make sure the /dev/myusbdisk filename is available after a reboot and can be used to mount a USB device.

Deliverable: A system that provides /dev/myusbdisk automatically after a reboot.

System Setup: System running in runlevel 5.

Instructions:

1. Modify the udev subsystem in such a way that /dev/myusbdisk gets automatically created at boot time.

Create a file named /etc/udev/rules.d/99-usb.rules and insert the following statement in it:

KERNEL=="sdb1", NAME="myusbdisk"

Note: Systems with IDE harddrives use sda for the first USB disk.

2. Reboot the system.

init 6

Plug a USB key to your system and verify that you now have a file named /dev/myusbdisk.

ls -l /dev/myusbdisk

3. MANDATORY CLEANUP: Remove the file you have created under /etc/udev/rules.d/ and unplug the USB device.

rm /etc/udev/rules.d/99-usb.rules

Sequence 3: Exploring processes, hardware and memory resources

Scenario: You want to determine what processes are running on your system, which hardware devices are available, and how much RAM is left.

Deliverable:

System Setup: System running in runlevel 5.

Instructions:

1. Determine the top-three processes with the largest memory footprint.

# top

Type “M” to sort processes in order of decreasing memory usage. The three processes at the top of the list are the three largest.

2. Determine the top-three processes with the largest cpu usage.

# top

Type “P” to sort processes in order of decreasing CPU usage. The three processes at the top of the list are the three busiest processes.

3. Start a window in which, using vmstat, a memory snapshot will be obtained every 5
seconds.

# vmstat 5

In parallel, start a memory-intensive application and observe the results.

# cat /dev/hda > /dev/null

4. Determine what network card (brand and/or model) is currently connected to your system.

You might first want to take a look at the lspci command.

The hal-device -manager will also display more information about the network interface card.

RH133读书 笔记(3) - Lab 3 Configuring the kernel的更多相关文章

  1. RH133读书笔记(1)-Lab 1 Managing Startup

    Lab 1 Managing Startup Goal: To familiarize yourself with the startup process System Setup: A system ...

  2. RH133读书笔记(2)-Lab 2 Working with packages

    Lab 2 Working with packages Goal: To gain working experience with package management System Setup: A ...

  3. RH033读书笔记(11)-Lab 12 Configuring the bash Shell

    Sequence 1: Configuring the bash Shell Deliverable: A system with new aliases that clear the screen, ...

  4. RH133读书 笔记(5) - Lab 5 User and Group Administration

    Lab 5 User and Group Administration Goal: To build skills for user and group administration. Estimat ...

  5. RH133读书 笔记(4) - Lab 4 System Services

    Lab 4 System Services Goal: Develop skills using system administration tools and setting up and admi ...

  6. RH133读书笔记(6) - Lab 6 Adding New Filesystems to the Filesystem Tree

    Lab 6 Adding New Filesystems to the Filesystem Tree Goal: Develop skills and knowlege related to par ...

  7. RH133读书笔记(9)-Lab 9 Installation and System-Initialization

    Lab 9 Installation and System-Initialization Goal: Successfully install Red Hat Enterprise Linux. Sy ...

  8. RH133读书笔记(8)-Lab 8 Manage Network Settings

    Lab 8 Manage Network Settings Goal: To build skills needed to manually configure networking Estimate ...

  9. RH133读书笔记(7)-Lab 7 Advanced Filesystem Mangement

    Lab 7 Advanced Filesystem Mangement Goal: Develop skills and knowlege related to Software RAID, LVM, ...

随机推荐

  1. ZOJ 1584:Sunny Cup 2003 - Preliminary Round(最小生成树&&prim)

    Sunny Cup 2003 - Preliminary Round April 20th, 12:00 - 17:00 Problem E: QS Network In the planet w-5 ...

  2. 别样JAVA学习(五)继承上(1.0)Object类equals()

    上一节继承下(一)我们进行抽象类.接口以及多态的学习. 接下来大家我们讲点特殊的东西就是object类, 我们一直在说继承,子继承了父,父还有没有父类呢, 为什么这么思考,大家想构造函数的第一行是不是 ...

  3. BaiduMap_SDK_DEMO_3.0.0_for_Xamarin.Android_by_imknown

    2.4.2 已稳定, 同一时候已经放置到分支/Release 2.4.2了. 3.0.0 已开发完毕, 可是不推荐大家用于项目中, 请观望或者自己进一步调试. 个人感觉尽管3.0.0简化了开发, 可是 ...

  4. 用cocos2d-x 3.2 实现的FlappyBird

    近期才開始学cocos2dx,买了几本书还有看大神(主要是 笨木头)的博客.然后就自己尝试用cocos2d-x实现了一下... (新手,勿喷...) 先看执行效果 http://pan.baidu.c ...

  5. HTML5拖动画布/拖放

    <!DOCTYPE HTML> <html> <head> <script type="text/javascript"> func ...

  6. SpringMVC @ResponseBody 415错误处理

    在查看下面部分内容之前,请先检查你的请求蚕食是否正确,如果全部正确,请继续往下看 刚开始用SpringMVC, 页面要使用jQuery的ajax请求Controller. 但总是失败,主要表现为以下两 ...

  7. 遇过的坑(2)—MyISAM表类型不支持事务操作

    最近需要通过JDBC对数据库做事务型操作,实践时发现,并没有达到想要的效果,表现在:1.每次执行executeUpdate()后,数据就马上能在DB中查到.但按理来说,我还没执行commit(),DB ...

  8. Context Switch and System Call

    How many Context Switches is “normal”? This depends very much on the type of application you run. If ...

  9. css样式hover图片闪烁问题

    主要是ie8及ie8以下版本浏览器会出现此问题, 问题核心是因为hover选择器没有缓存即将要替换的图片, 所以导致替换期间有一个极其短暂的空白期. 解决方案: 采用 background-posit ...

  10. pygame系列_箭刺Elephant游戏

    这个游戏原名为:Chimp,我们可以到: http://www.pygame.org/docs/tut/chimp/ChimpLineByLine.html 获取到源码和详细的源码讲解 下面是我对游戏 ...