Welcome to Linux Screw! If you're new here, you may want to subscribe our RSS feed.
Question: I want to reset counters in /proc/net/dev (also shown in ifconfig output as RX and TX bytes) and thus I have to unload network interface driver. How to do it?
Answer: There are two commands in Linux CLI coming by default which would help to unload drivers: rmmod and modprobe. First of all it is necessary to find what kernel module controls certain NIC and then unload that module. For example, you have VIA VT6102 (RHINE-II) network card that is recognized by Linux as eth0 and want to disable its driver temporarily. Just execute the following:
"sudo rmmod via-rhine" or "sudo modprobe -r eth0" (or "sudo modprobe -r via-rhine"). You can use command dmesg to determine the name of kernel module you wish to unload.
Share This
Question: How can I restrict/allow access to certain service on timely basis with iptables? For example restrict access to SSH between 7:00 pm - 8:00 am on weekdays?
Answer: You are welcome to use iptables patch-o-matic extension (pom or p-o-m) that allows you to match a packet based on its arrival or departure (for locally generated packets) timestamp. The syntax is the following:
iptables RULE -m time --timestart TIME --timestop TIME --days DAYS -j ACTION
Where:
--timestart TIME: Time start value (format is 00:00-23:59)
--timestop TIME: Time stop value (the same format)
--days DAYS: a list of days to apply, from (format: Mon, Tue, Wed, Thu, Fri, Sat, Sun).
To add the rule stated in the question use the following command:
iptables -A INPUT -p tcp -d 192.168.0.1 --dport 22 -m time --timestart 19:00 --timestop 8:00 -days Mon,Tue,Wed,Thu,Fri -j DROP
Hope it helps!
Share This
Question: How can I get information about hardware manufacturer, model name, serial number, BIOS information using Linux command line (CLI)?
Answer: You are welcome to use dmidecode which helps to get information about your system’s hardware as described in your system BIOS. That information typically includes system manufacturer, model name, serial number, BIOS version, asset tag as well as a lot of other details depending on the manufacturer.
Beware that DMI data have proven to be too unreliable to be blindly trusted. Dmidecode does not scan your hardware, it only reports what the BIOS told it to. Dmidecode was first written by Alan Cox and is now being further developed and maintained by Jean Delvare. It is released under the General Public License (GPL).
This tool can be easily downloaded from here (source code) or can be installed as binary package included into repositories of many distributions like Debian, Ubuntu, Gentoo. FreeBSD version is also available. Actualy it is reported that dmidecode works well on the following systems:
- Linux i386
- Linux x86_64
- Linux ia64
- FreeBSD i386
- FreeBSD x86_64
- NetBSD i386
- OpenBSD i386
- BeOS i386
- Cygwin i386
- Solaris x86 (CVS version)
In Ubuntu (my favourite distro) just execute the following: sudo aptitude install dmidecode (sample output is here).
Share This
Static routing is the term used to refer to the manual method used to set up routing. An administrator enters routes into the router using configuration commands. This method has the advantage of being predictable, and simple to set up. It is easy to manage in small networks but does not scale well.
Question: How can I save static routes I set up in my Fedora/RedHat/CentOS Linux after I reboot server?
Answer: In Fedora Linux (or RedHat, CentOS) you can set up static routes for certain network interface (for example eth1) by editing file /etc/sysconfig/network-scripts/route-eth1.
For example, you have to save static route added by the following command:
route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.100.1 dev eth1
To do it, just add the following line to /etc/sysconfig/network-scripts/route-eth1:
ADDRESS0=192.168.0.0
NETMASK0=255.255.255.0
GATEWAY0=192.168.100.1
Share This
Ext4 is the latest in a long line of Linux file systems, and it’s likely to be as important and popular as its predecessors. As a Linux system administrator, you should be aware of the advantages, disadvantages, and basic steps for migrating to ext4. IBM DeveloperWorks article explains when to adopt ext4, how to adapt traditional file system maintenance tool usage to ext4, and how to get the most out of the file system:
The single most dramatic improvement in ext4 is in file and file system size. Thus, the users who are most likely to need ext4 are those who have more than a few terabytes of disk space. The list of features in Table 1, though, may present some other tempting improvements. For instance, you might want to try ext4 if you have directories with huge numbers of subdirectories or if you need timestamps accurate to less than a second. Read more >>
Share This
Date: May 1, 2008. Categories:
video and tips.
Why spend $100 or more on a Wi-Fi antenna when you can create your own one for $10? The following components are needed:
- 35-mm foam (like the kind desktop and laptop PCs usually come with)
- Solid-core copper wire
- Small brass plate
- Multiple BNC connectors
Follow the instructions in the video:
Share This
Today it is possible to install Ubuntu Linux 8.04 (Hardy Heron) under Windows XP or Vista without necessity to create separate partition for it. The tool that allows to do it is called Wubi. Actually it is Ubuntu installer for Windows helping you ro install and uninstall Ubuntu with few clicks. Here is nice brief article on how to set it up under Vista:
Wubi adds an entry to the Windows boot menu which allows you to run Linux. Ubuntu is installed within a file in the Windows file system (c:\wubi\disks\system.virtual.disk), as opposed to being installed within its own partition. This file is seen by Linux as a real hard disk.
Sweeet! 
Share This
Recent Ideas