Tag Info

Hot answers tagged

87

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 ...


15

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 # ...


15

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 ...


14

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


12

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 ...


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 ...


11

Yes, ifconfig is deprecated in favor of iproute2 (the ip command) on Linux. 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 at those 3 links : iproute2: Life after ifconfig (the basics, from ...


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 ...


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 :)


7

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


7

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


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

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.


5

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 ...


5

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?


5

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 ...


5

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.


5

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

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 ...


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

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 ...


4

You can try "route" to print you're routing table which will show you the destination networks and gateways for your various interfaces. If the IP addresses don't help you determine the interface easily, run "traceroute," after running route, look at the first hop and compare it with the associated gateways from "route," and voila - that's your interface. ...


4

I think your file /etc/resolv.conf is not present or no entries in that. Generally it contains the nameserver address which is nothing but DNS server address. All domain names like google.com etc will be resolved by using that DNS server. Incase of ssh root@**.126.18.56, it is working because here you are giving direct IP address instead of name.


4

What OS and VM are you using? If you aren't adding a new IP and only updating the I'd just edit one of the two files depending if you are using a Debian flavored OS or a Redhat based OS With Debian based (e.g., Ubuntu, Debian, Xandros, Mint) the change the settings in /etc/network/interfaces followed by: service networking restart RedHat based (e.g., ...


4

You appear to have some "useless use of sudo" in this script. That is, if you can run this successfully: /sbin/ifconfig wlan0 down Then you're probably already root, so you should be able to: /sbin/iwconfig wlan0 essid "WLA_NETWORK" without using sudo. There are a couple of things that could prevent your script in its current form from running: ...


4

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.


4

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 ...


4

Just specify the same IP address as currently configured with the new subnet mask to the ifconfig command. ifconfig eth0 `/sbin/ifconfig eth0 | grep "inet addr" | tr -s " " | cut -f 3 -d " " | cut -f 2 -d ":"` netmask 255.255.255.0 (That makes me feel dirty...) Edit: Having said that, on an old-as-heck Fedora Core 2 box (the oldest box I could find on ...


4

The collisions counter for an ipip tunnel interface is increased in two cases: If the next hop of the encapsulated packet is the same tunnel interface: ipip.c line 437. If the path MTU of the next hop for the encapsulated packet is less than 68: ipip.c line 447. Both of these cases can usually happen only if the encapsulated traffic loops back into the ...


4

In FreeBSD an ifconfig that removes direct connectivity to a subnet also zaps routes containing that subnet (IIRC updating netmasks is reduced to a remove-and-replace). This is a "feature" so as not to confuse your routing configuration by trying to talk to a host it can't reach anymore, though it causes its share of confusion when users encounter ...



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