How to set a custom HTTP header in curl

Question: I am trying to fetch a URL with curl command, but want to set a few custom header fields in the outgoing HTTP request. How can I use a custom HTTP header with curl? curl is a powerful command-line tool that can transfer data to and from a server over network. It supports a […]
Continue reading…

 

How to download and install ixgbe driver on Ubuntu or Debian

Question: I want to download and install the latest ixgbe driver for my Intel 10 Gigabit Ethernet card. How can I install ixgbe driver on Ubuntu (or Debian)? Intel’s PCI Express 10 Gigabit (10G) network inerface cards (e.g., 82598, 82599, x540) are supported by ixgbe driver. The stock kernel of the modern Linux distributions already […]
Continue reading…

 

How to reset RX/TX counters of a network interface

Question: I am testing a network interface card (NIC), and currently ifconfig command reports huge numbers on RX/TX and error/dropped counters on some interface. Is there a way to reset ifconfig packet counters on a network interface without rebooting the server? On Linux, each network interface comes with several packet counters such as RX (number […]
Continue reading…

 

How to disable HTTP redirect in wget

Question: When I run wget to fetch a URL X which is redirected to another URL Y, wget, by default, goes fetch URL Y automatically. However, I would like to force wget to only fetch the original URL X without following the redirection. How can I stop wget from following a redirected URL? In the […]
Continue reading…

 

How to open a port in the firewall on CentOS or RHEL

Question: I am running a web/file server on my CentOS box, and to access the server remotely, I need to modify a firewall to allow access to a TCP port on the box. What is a proper way to open a TCP/UDP port in the firewall of CentOS/RHEL? Out of the box, enterprise Linux distributions […]
Continue reading…

 

How to fix “sshd error: could not load host key”

Question: When I try to SSH to a remote server, SSH client fails with “Connection closed by X.X.X.X”. On the SSH server side, I see error messages: “sshd error: could not load host key.” What is going on, and how can I fix this error? The detailed symptom of this SSH connection error is as […]
Continue reading…

 

How to configure a static IP address on CentOS 7

Question: On CentOS 7, I want to switch from DHCP to static IP address configuration with one of my network interfaces. What is a proper way to assign a static IP address to a network interface permanently on CentOS or RHEL 7? If you want to set up a static IP address on a network […]
Continue reading…

 

How to change a network interface name on CentOS 7

Question: On CentOS 7, I would like to change the assigned name of a network interface to something else. What is a proper way to rename a network interface on CentOS or RHEL 7? Traditionally, network interfaces in Linux are enumerated as eth[0123…], but these names do not necessarily correspond to actual hardware slots, PCI […]
Continue reading…

 

How to capture TCP SYN, ACK and FIN packets with tcpdump

Question: I want to monitor TCP connection dynamics (e.g., three-way handshake for connection establishment, and four-way handshake for connection tear-down). For that, I need to capture only TCP control packets such as those with SYN, ACK or FIN flag set. How can I use tcpdump to capture TCP SYN, ACK, and/or FYN packets only? As […]
Continue reading…

 

How to change hostname on CentOS or RHEL 7

Question: What is a proper way to change hostname on CentOS / RHEL 7 (permanently or temporarily)? In CentOS or RHEL, there are three kinds of hostnames defined: (1) static, (2) transient, and (3) pretty. The “static” hostname is also known as kernel hostname, which is initialized from /etc/hostname automatically at boot time. The “transient” […]
Continue reading…

 

How to show a MAC learning table of Linux bridge

Question: I would like to check MAC address learning status of a Linux bridge that I created with brctl tool. How can I view the MAC learning table (or forwarding table) of a Linux bridge? A Linux bridge is software implementation of a network bridge, which is part of Linux kernel. Similar to hardware bridge, […]
Continue reading…

 

How to fix “X11 forwarding request failed on channel 0”

Question: When I tried to SSH to a remote host with X11 forwarding option, I got “X11 forwarding request failed on channel 0” error after logging in. Why am I getting this error, and how can I fix this problem? First of all, we assume that you already enabled X11 forwarding over SSH properly. If […]
Continue reading…

 

How to turn off server signature on Apache web server

Question: Whenever Apache2 web server returns error pages (e.g., 404 not found, 403 access forbidden pages), it shows web server signature (e.g., Apache version number and operating system info) at the bottom of the pages. Also, when Apache2 web server serves any PHP pages, it reveals PHP version info. How can I turn off these […]
Continue reading…

 

How to enable and configure desktop sharing on Linux Mint Cinnamon desktop

Question: I was trying to enable desktop sharing via Vino VNC server (vino-server) on Linux Mint 17 Cinnamon desktop. However, I notice that vino-preferences tool which allows us to configure vino-server (e.g., sharing option, security, notification on/off) no longer exists. Also, I cannot find desktop sharing menu on Cinnamon desktop. How can I configure desktop […]
Continue reading…

 

How to enable SR-IOV virtual function on Intel ixgbe NIC

Question: I want to create virtual functions on an Intel ixgbe NIC port. How can I enable SR-IOV virtual function on an ixgbe NIC interface? SR-IOV is a technology which allows a single PCIe (PCI Express) device to emulate multiple separate PCIe devices. The emulated PCIe functions are called “virtual functions” (VFs), while the original […]
Continue reading…

 

How to connect to a serial port on Linux

Question: I need to access the management terminal of a hardware switch/router (e.g., Cisco Catalyst or HP ProCurve) via its console port. The switch console port is connected to the serial port of my Linux box. How can I connect to the serial port from a Linux terminal? First of all, let’s assume that you […]
Continue reading…

 

How to change network interface names permanently in Linux

Question: I want to change a network interface name (e.g., “eth0”) to something else on my Linux. What is a proper way to rename network interfaces on Linux? In Linux, device name management is handled by udev system. When Linux kernel discovers a new device (e.g., a network interface card) added to the system, it […]
Continue reading…

 

How to check which program is using a port on Linux

Question: My program cannot bind to a particular port number because it is used by another program/process which I don’t know. Is there any way to check which program/process is using a port on Linux? You can detect which process is bound to what port number by using lsof command. Simply specify the port number […]
Continue reading…