Tag Info

Hot answers tagged

95

Quoting Thomas Pircher's website (cc-by-sa): ifconfig vs ip The command /bin/ip has been around for some time now. But people continue using the older command /sbin/ifconfig. Let's be clear: ifconfig will not quickly go away, but its newer version, ip, is more powerful and will eventually replace it. The man page of ip may look intimidating at first, but ...


20

The official statement regarding the plans to obsolete net-tools was made on the debian-devel mailing list in early 2009 by one of the net-tools maintainers. True to their statement, net-tools has been hardly maintained at all since that time. Luk Claes and me, as the current maintainers of net-tools, we've been thinking about it's future. Net-tools ...


19

You can get all necessary info via proc # cat /sys/class/net/eth0/statistics/rx_bytes # cat /sys/class/net/eth0/statistics/rx_packets # cat /sys/class/net/eth0/statistics/tx_packets # cat /sys/class/net/eth0/statistics/tx_bytes Also you can use iptables and parse output. For received packets # iptables -L INPUT -n -v for transmitted packets # ...


19

Another option is to use the /proc filesystem. The /proc/net/dev file contains statistics about the configured network interfaces. Each line is dedicated to one network interface and it contains statistics for receive and transmit. The statistics include metrics such total number of received/transmittted bytes, packets, drops, errors and so on. cat ...


19

The ip command which is part of the the iproute2 package is the new tool. The link subcommand is for managing the devices/interfaces. If you can get the stats of an interface using ip -s link root:~# ip -s link 1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 RX: bytes ...


17

ifconfig is deprecated for many years now, time to switch, especially in a case like yours.


16

Yes, ifconfig is deprecated in favor of iproute2 (the ip command) on Linux. Similarly, the arp, route and netstat commands are also deprecated. However, iproute2 is Linux specific, when some other Unixes use ifconfig, so it may help to know/remember how it works if you're ever going to use another Unix... To learn the "new way", I suggest you to look ...


14

On the man page of ifconfig for Fedora, it says this: IFCONFIG(8) Linux System Administrator's Manual IFCONFIG(8) NAME ifconfig - configure a network interface SYNOPSIS ifconfig [-v] [-a] [-s] [interface] ifconfig [-v] interface [aftype] options | address ... NOTE This program is obsolete! For replacement ...


12

You need to configure those IPs on that interface. ip addr add 72.9.239.195/29 dev eth1 ip addr add 72.9.239.196/29 dev eth1 ip addr add 72.9.239.197/29 dev eth1 ip addr add 72.9.239.198/29 dev eth1 You can also use the ifcfg-eth1:n files in /etc/sysconfig/network-scripts to make this configuration last across reboots. See Red Hat's documentation for ...


10

Generally speaking, "promiscuous mode" means that a network interface card will pass all frames received up to the operating system for processing, versus the traditional mode of operation wherein only frames destined for the NIC's MAC address or a broadcast address will be passed up to the OS. Generally, promiscuous mode is used to "sniff" all traffic on ...


9

There might be a utility, but I don't know what it is. You can just create a file at /etc/sysconfig/network-scripts/ifcfg-eth0 with contents similar to: DEVICE=eth0 BOOTPROTO=static ONBOOT=yes IPADDR=192.168.0.199 NETMASK=255.255.255.0 GATEWAY=192.168.0.1


8

You do not need root access to use ifconfig to change IP addresses, only CAP_NET_ADMIN. Let's create a copy of ifconfig with CAP_NET_ADMIN enabled to see this: cp /sbin/ifconfig . sudo setcap cap_net_admin=eip ./ifconfig ./ifconfig eth0 1.2.3.4 # succeeds # Wouldn't want to leave this copy of ifconfig around, # It's a security hole! rm ifconfig


8

This is a distro-specific issue. net-tools has been deprecated by just about every major distro (or distro upstream), though, so in effect the entire community is switching from ifconfig to ip -- but the change is slow, as some distros have an extremely long shelf-life (RHEL,for example). You are less likely to find a deprecation announcement than an item ...


7

Something fairly simple that you can modify to suit your needs: ip addr show dev eth0 | fgrep -q 'inet 192.168.1.1' if [ $? -eq 0 ]; then echo 'IP found' else echo 'IP not found' fi EDIT: forgot the fgrep :)


6

This question has been answered on SF already. In short, the only way on a Linux box (at present) is to reload the network driver module, which may or may not be possible with your kernel configuration.


6

Flush the ip: root@foo:~# ifconfig dummy0 192.168.55.1 netmask 255.255.255.0 root@foo:~# ifconfig dummy0 dummy0 Link encap:Ethernet HWaddr 5b:72:32:4f:92:c8 inet addr:192.168.55.1 Bcast:192.168.55.255 Mask:255.255.255.0 UP BROADCAST RUNNING NOARP MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 ...


6

eth0 and eth0:0 are the same interface. Use eth0:1 for an alias. Could it be that DEVICE=eth0 should actually be DEVICE=eth0:0?


6

I would say it is the 4GB wraparound as you are guessing. I ran into this with fairly recent 32 bit linux kernels. You can grab the source code for your kernel and see if it is the same in include/linux/netdevice.h and check the data type of net_device_stats->rx_bytes. If you are using a 32 bit system and the time is an unsigned long you will get only ...


6

Carrier errors occur when there is a problem with the modulation of your signal. This could indicate either a duplex mismatch, or a problem with the physical cable/connector. Restarting autonegotiation and checking the ethernet connector are some things you could try to fix the problem. Look here for some instructions on how to restart autonegotiation.


6

RX errors mean that your NIC is receiving malformed frames from the transmitting switchport. Frame errors mean CRC failures on receipt of a frame. The root cause of this could be a bad cable, or a bad interface on either the machine or the switch. Try replacing the cable, then moving to another port on the switch.


6

Check out the facter package. It is used mostly by the puppet config management program to grab metadata from installed machines, but it can be run in a standalone fashion for similar purposes. Its output does include information about network interfaces found on the machine, and its formatting will be consistent across platforms. Example output: ...


6

ip has been the replacement for ifconfig for a while, probably at some point ifconfig will update, however I wouldn't wait for it and learn to work with ip as well. Its supported on all linux distri's


5

10.0.2.15 is your system's address, .255 is the broadcast address for the subnet. /24 is CIDR notation for the subnet mask; it means that 24 bits of the 32 bit IPv4 address are the network and the other 8 bits are the addresses within the subnet. See this question for more information.


5

It's consistent network device naming. Systems, particularly servers, with multiple network ports, name the ports ethX in a non-deterministic order, and are therefore not useful for system administrators. System Administrators can then use BIOS-provided names, which are consistent and not arbitrarily named, for their network ports. This eliminates ...


5

Use multicast. Each client would need to join the group, but this is a very low overhead task. You'd have the additional benefit of being able to have clients on other machines be able to efficiently receive the message. Failing this, look into one of the various message bus packages (i.e. mqueue, rabbitmq, etc) that will allow for reliable delivery of ...


5

From that output.. you only have 1 IP on the interface. You have been assigned that block but you have to alias the other IPs to that interface. You can see if you have them aliased via ip address show quick and old way is using ifconfig to add aliases ifconfig eth1:1 72.9.239.195 netmask 255.255.255.0 Same command for the other IPs.


5

There's no difference; dev is optional provided the device name can't be mistaken for another keyword that the ip command understands. For instance, if you had an interface named bridge then you would have to use dev as bridge is also a keyword that ip uses. This is undocumented behavior, but it certainly appears to work. You'll know if you ran afoul of ...


5

The order in which the addresses are down isn't really relevant. The problem is that Linux usually uses the first configured address as default source address for IPv4 but the last configured address for IPv6. That that address shows up on top is coincidence. If you want to manually define the default source address you can do so in the routing table. This ...


5

You do not "add" a broadcast address. You direct traffic to the broadcast address of a network. The broadcast address is an entirely virtual concept, and should not be "added" or otherwise assigned to any host in normal practice. The exception to the above rule is specifying the broadcast address (using ifconfig broadcast) which is done in cases where ...


4

ifup is a command that reads the /etc/network/interfaces (or other files depending on distro) brings the link up and correctly configures the interfaces as specified. Running ip link only changes or shows the link status. It does not read the configuration file, it does not make any other changes. As far as I can tell the only issue here is that you have ...



Only top voted, non community-wiki answers of a minimum length are eligible