Sponsored Content
Top Forums Shell Programming and Scripting Script getting IP's and MAC addresses Post 303006600 by hermouche on Saturday 4th of November 2017 10:10:39 AM
Old 11-04-2017
RedHat Script getting IP's and MAC addresses

Hy over there,

Lets make it simple Smilie

Using a bash script, how to grep only the ip address and the mac address and put them in a file:.

for example from the dhcp.conf file we got such things:

Quote:
host s6 {
hardware ethernet aa:aa:aa:aa:aa;
fixed-address 192.168.0.254;
}

host s5 {
hardware ethernet xx:xx:xx:xx:xx:xx;
fixed-address 192.168.0.253;
}

The script will end up with two columns IP's and MAC adresses as it is showed below:

192.168.0.254 aa:aa:aa:aa:aa:aa
192.168.0.253 xx:xx:xx:xx:xx:xx:xx

Thanks for helping Smilie
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Mac addresses of NICs (why are they the same)

I am training to be support on our solaris based network and was wondering why solaris seems to assign the same mac address to all NICs placed in the machine regardless of how many NICs are in there, when i do a ifconfig -a all nics have same MAC. Presumably this is a feature and there is... (1 Reply)
Discussion started by: hcclnoodles
1 Replies

2. Shell Programming and Scripting

Script to get IP addresses of LAN computers

I need a shell script for OS X, one that can find IP addresses of machines connected to my LAN, get the names of the computer associated with those addresses, then display them like so in a list: "Bob's L33T Boxx: #.#.#.#" Something like the network scanner in Apple Remote Desktop is what I'm... (1 Reply)
Discussion started by: sladuuch
1 Replies

3. UNIX for Dummies Questions & Answers

Help extracting MAC addresses from List

Hello all. I have a large number of text files outputted from various Netstumbler Wireless Scans; from which I need to extract the MAC addresses of the various Access Points. The Text files look like this: # $Creator: Network Stumbler Version 0.4.0 # $Format: wi-scan summary with... (9 Replies)
Discussion started by: dhs23
9 Replies

4. Shell Programming and Scripting

Need help with IP and MAC addresses

Hi, i am working on a project where i have to write a script to find out MAC addresses of the systems with given IP address. Can anybody tell me which command i can use to find MAC address if you know IP address of the machine. Thanks (5 Replies)
Discussion started by: manmeet
5 Replies

5. Shell Programming and Scripting

Help with bash script to block IP addresses

I am using a bash script for CentOS 5.5, I found one and modified it, however I want to block the incoming IP addresses and ALLOW the IP addresses that are blocked to send out email. I will use an internal network range for an example, 10.10.10.0/24 (if a lot of spam is incoming) from this range... (0 Replies)
Discussion started by: grifs71
0 Replies

6. Shell Programming and Scripting

script to get all ip addresses of servers into a file

Hi all i need to create a script that pings every server in my range (0-254) adn then returns the values to a file? can anyone please help. i am working in the tcsh ( and yes i know how to ping ) but i dont know how to ping them all in one script without copying and pasting a 254 times? ... (1 Reply)
Discussion started by: brian112
1 Replies

7. UNIX for Dummies Questions & Answers

Difference between Mac and IP addresses

If a web search is done on this topic there are many links but no information included in the documents. So my questions are; Why does a NIC card have it's own permanent ID. Why can't it share the host name? An ID is an ID. Why does a computer need two ways to ID it. If the network... (3 Replies)
Discussion started by: theKbStockpiler
3 Replies

8. Windows & DOS: Issues & Discussions

Script to ftp in to multiple ip addresses

Hello Is there an easy way to login to various ip's..one after the other. I need to login to about 30 aix boxes and put a file in each one... Cheers (1 Reply)
Discussion started by: Grueben
1 Replies

9. UNIX for Dummies Questions & Answers

Script to ftp in to multiple ip addresses

Hello Is there an easy way to login to various ip's..one after the other. I need to login to about 30 aix boxes and put a file in each one... Cheers (1 Reply)
Discussion started by: Grueben
1 Replies

10. Shell Programming and Scripting

Don't see my mac addresses of my devices

I have a problem with a script , i want to see my devices there are up in my network. I want as output the ip addresses of the devices and also the mac address but I only had the ip addresses #!/bin/bash while ] do -mac) Extension=5 shift mac=$1 shift ;; esac... (1 Reply)
Discussion started by: Roggy
1 Replies
XVIF(4) 						 BSD/xen Kernel Interfaces Manual						   XVIF(4)

NAME
xvif -- Xen backend paravirtualized network interface SYNOPSIS
pseudo-device xvif DESCRIPTION
The xvif interface forms the backend part of the paravirtualized drivers used by Xen domains to offer network connectivity. When the guest domain is NetBSD, the endpoint of the xvif interface is a xennet(4) interface. In the XenStore, xvif and xennet are identi- fied by ``vif'' (virtual interface) entries. All xvif interfaces follow the ``xvifXiY'' naming convention, where 'X' represents the guest domain identifier, and 'Y' an arbitrary identi- fier; most of the time, it is the frontend interface identifier, e.g. ``xennetY''. For convenience, the MAC address of an xvif interface is chosen by incrementing the third byte of the MAC address of the frontend device. Conceptually, frontends and backends drivers are similar to two Ethernet cards connected via a crossover cable. DIAGNOSTICS
xvif%di%d: can't read %s/mac: %d The MAC address for this interface could not be read from XenStore. xvif%di%d: %s is not a valid mac address The MAC address specified in the configuration file of the newly created guest domain is invalid. xvif%di%d: Ethernet address %s MAC address of the xvif interface. SEE ALSO
ifmedia(4), xennet(4), ifconfig(8) HISTORY
The xvif driver first appeared in NetBSD 4.0. AUTHORS
The xvif driver was written by Manuel Bouyer <bouyer@NetBSD.org>. BSD
April 7, 2011 BSD
All times are GMT -4. The time now is 10:04 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy