I've done a lot of network programming (games and enterprise), and I'm currently building my own sequential guaranteed layer on top of UDP, and would like to bounce some ideas off like minded individuals ;)
So one of the modules I'm having in my university right now is "Network Programming" and I've been doing pretty well so far. We've been creating stuff like ping, traceroute implementations, packet sniffer and a chat application.
The next two assignments are to build a firewall and an IPSec tunnel. Now I'm stuck on the firewall and I feel really discoursged now since I did the previous assignments well.
For the firewall we were told to create two linux VMs on different subnets and connect them via a third linux VM that had an interface for each of the two subnets. The firewall needs to run on this third VM. It needs to check incoming packets against a list of ACLs we can give and make the forwarding decision accordingly.
We were also told to disable ip forwarding on this VM. So we have to create our own routing mechanism and then add the ACL component.
We were also told not to use scapy or any other module like that. We have to do all our assignments with the python 'socket' and 'struct' modules.
My main problem is on how to do the routing. I feel a bit overwhelmed by this one so if anyone can give me some idea on how to approach this it would be a great help.
I need to learn network programming, and Unix sockets. I want to be able to understand about IP addresses, Subnet masks, TCP/IP. HTTP, UDP, FTP, SFTP, SSH, network interfaces, MAC addresses, broadcasting, multicasting. statis IP addresses, DHCP.....I could carry on forever, I have been dealing with these concepts without really understanding them. I'd like to study about these things and understand what it's really going on.
Could anyone recommend a very good tutorial, online course, classical book?
I am a c++ programmer, so if it is something with C++ examples/exercises even better. I can also do Python.
I’m considering developing a custom IRL streaming bonding solution so that I can round Robin UDP through SRT on 3 or more cellular modems to my home Pc where I will reconstruct, send to OBS and then finally out to RTMP. All of which so I can live stream my big European motorcycle trip to twitch/YouTube.
Now.. I don’t know if I need to factor packet retransmission into my bonding software? Given that SRT works over UDP then I assume that, so long as I forward the same length as the packet header dictates to a particular modem (so that a discrete header + data payload is not separated on different modems) then I do not need to request retransmission (although something to score and factor out badly performing cellular modems might prove useful).
SRT apparently has some monitoring and descaling built in but (and this is my main question) how can it know? If it’s over UDP (and it definitely is)?
I always thought that UDP was fire and forget; you don’t know if the traffic reached its peer.
However… this assumption must be wrong I think? Because a quick google on ‘How to detect if network is dropping UDP packets?’ shows answers which use netcat to connect to endpoints over udp.
I've been in technology since elementary school. In 4th grade after math class, we'd go to a small computer lab and practice simple algorithms on Apple III's using 5.25" floppy disks. I always loved technology but I've never been really all that great with math.
I'm trying to advance my knowledge of these underlying algorithms and hope to reinforce my knowledge of mathematics to supplement my extensive Cisco Routing experience (CCNA in 2005, large scale ISP/MSO backbone routing experience) with the true low-level fundamentals. Eventually I'd like to move into network development, automation, SDN/APIs, and design, and I see this as a first step to that goal. Direction and off the wall thoughts are appreciated.
One thing I'm trying to do is really grasp the limitations of the algorithm and how using graph theory can deepen my understanding of network design and architecture, as well as help with next-generation networks using white box devices and centralized controllers.
I posted this in r/Networking but they locked my thread because apparently it "has nothing to do with network engineering."
1 function Dijkstra(Graph, source):
2
3 create vertex set Q
4
5 for each vertex v in Graph:
6 dist[v] ← INFINITY
7 prev[v] ← UNDEFINED
8 add v to Q
9 dist[source] ← 0
10
11 while Q is not empty:
12 u ← vertex in Q with min dist[u]
13
14 remove u from Q
15
16 for each neighbor v of u still in Q:
17 alt ← dist[u] + length(u, v)
18 if alt < dist[v]:
19 dist[v] ← alt
20 prev[v] ← u
21
22 return dist[], prev[]
I have all the code written up to this point, I need a "unique enough" hex value/s for the data field in a UDP packet to function as a magic number to begin defining a protocol/format.
I am chunking files and dispatching them after encryption to be reassembled and decrypted at the other end and am wanting to have file sizes that necessitate multiple packets
My plan here is to send packets, but keep them in the send queue, until I receive and ACK for the given packet. If I don't recieve and ACK in a pre-defined time, I'll re-send the packet.
On the reciever side, I'll send an ACK for the recieved packet. But what if the ACK is lost?
If I recieve a packet sequence number I already recieved, it must be because the packet is re-send, and then I'll re-send the ACK.
In my new UDP library, I'm going for enqueuing packets to be send and packets recieved, so I control when they are send to the listeners, and when packets are processed.
What I'm going to try, is to have two threads. One with blocking recieve that just throws raw data in the queue, and one send, that just loops through the send queue and send them away. Notice this is the raw transfer layer, and guaranteed, sequenced delivery is handled elsewhere :)
What do you guys think? Pros/cons? As long as packets are stuffed in queue as fast as possible, there should not be an issue with a single blocking UDP recieve on a given port.
basically what i need to know what sort of requirements there are for the rendezvous server. If my clent a and the server are behind a nat that supports hairpinning and client b is on the other side of the nat, neither the public or the private address b get's from the server will allow b to connect with a and the whole punching will fail. Pls tell me why i'm wrong or how i can fix it.
Hello! Curious if anyone knows of a python3 library or module that offers socket-module-like functionality, but let's you manipulate header fields (e.g. IP TTL, IP ID, TCP ISN, etc).
I am currently working with raw socket objects but wanted to see if there was something that already existed.
I've followed a guide on how to craft ethernet packets, with IP and UDP however when I send them, I check Wireshark and it reports that the Ethernet frame check sequence is incorrect, in fact it's completely blank...
I've managed to be able to manipulate the bit fields for FCS (meaning all I now need is the algorithm).
Is there a Unix header that can generate the CRC?
I presume it's a case of calculating the CRC on the ethhdr struct?
I just finished in CCNA R and S certification. My current job has very little to do with networking. I have very little knowledge about Python. I am really interested in network automation and programming. How do I start my journey towards network automation? Are there any courses that can help me with that ? Or is it better to change my job first , get appointed as a network engineer and get the hang of things first and then think about automation ?
So I'm taking a class at University of Nevada Reno that is a special topics class on cyber physical systems security. The special topics means that this is a class that is not normally taught and doesn't have a set guideline or curriculum. The professor teaching this class has a interest in teaching the concepts of security of cyber physical systems but is for the most part winging it. Network programming knowledge is not a requirement but is recommended. Due to the nature of the class, I believe it is not required only as to draw more students though I know it will be necessary to complete the assignments in the class. As far as course load is concerned, there will be three projects and two presentations. The projects will be something to the effect of 1) creating a secure system, 2) hacking said system and 3) finding ways to better protect the system. I'm fairly confident in programming, at least to the level I'm expected to by the University which means using inheritance, templates, linked lists and stacks, but am not familiar with network programming in the slightest. The professor has said that he will cover basics of network programming though I'm fairly certain it won't be extensive. How might I best prepare myself? I know that network programming will be necessary but am unfamiliar with it. Any suggestions as to leaning this will be greatly appreciated, especially those suggestions that might lead to an expedited (basic) understanding. I am currently reading hacking, the art of exploitation because it seems to have an overview, at the least, of network programming.
Then, I decided to try second script to find all interfaces which has NOT been explicitly "shutdown".
$ cat script2.py
from ciscoconfparse import CiscoConfParse
print('print all interfaces without shutdown')
parse = CiscoConfParse('exampleswitch.conf', syntax='ios')
for intf_obj in parse.find_blocks(r'^((?!sshutdown).)*$'):
print(intf_obj)
$
Output
$ python script2.py
! filename:exampleswitch.conf
!
hostname ExampleSwitch
!
no ip domain lookup
!
interface GigabitEthernet 1/1
switchport mode trunk
no ip address
!
interface GigabitEthernet 1/2
no cdp enable
shutdown
!
interface GigabitEthernet 1/3
ip address 192.0.2.1 255.255.255.0
!
interface GigabitEthernet 1/4
switchport mode access
shutdown
!
$
However, it didn't really work as expected. What I wanted is only interfaces configuration without "shutdown" keyword in it's interface block and not the whole configuration file like the output below.
Desired Output
$ python script3.py
interface GigabitEthernet 1/1
switchport mode trunk
no ip address
interface GigabitEthernet 1/3
ip address 192.0.2.1 255.255.255.0
$
Another question. For sequencing, I'm just going to up the number on each send for client and on server. If a sequence appears that's higher og lower than expected, the packet is dropped. I only want to support the latest packet for non-guaranteed UDP, as I want to exploit this in my game, for easier handling. So important events are guaranteed, but say and input/movement event, you don't want the old data :)
So I guess the question is, should there be a sequence for each packet type? Since we only want the latest of a certain packet? And what happens when the sequence number wraps? I know an integer will take some two years to do that, but maybe the client and server could agree on when to wrap? But that could cause en issue if there is a slight mismatch between the client and server (it is UDP after all), which could cause the wrapped packet to be rejected, but maybe that would sort itself out after a few packets? ;)
Now I am stuck in the first figure (figure 3 actually).
What I got is in figure 2. whatever how hard I work on this.
What I Did
I used Python and networkx.
First build the ER network with 1000 nodes, and the probability is depends on which average degree I want to simulate. For example if I want to simulate the average degree at 3, then the probability of generating ER network is 3/(1000-1) where 1000 is the network size.
Then for each node I find how many nodes point towards it and count, to calculate the AiIB (weights). If node 1 have 3 nodes point towards it, then the weights on these edges is AiIB (0.2 in paper) / 3 (number of neighbours).
To simulate contagion, first randomly chose one node to remove all its assets. then it cannot payback the liabilities to its neighbours if the liability is more than the capital buffer (Ki, 0.04 in paper). For those banks received liabilities from more than one banks, even each link's weight is less than the Ki, if the sum of these liabilities is more than Ki it still be considered as bankrupt.
As contagion is defined as, more than 5% of the banks bankrupt in this network ( 50 in this case).
To plot the figure, each average degree need to be test 100 times:
probability = number of contagion happened / simulation times 100 here
extent = [under the case of happen contagion] sum of fraction of bankrupt banks / number of contagion happened
The raw code is available on GitHub. By running er_100.py you can get the figure 2. if you have any trouble of the code please let me know.
Problems
As you can see mine results is far away from the paper's. Mine seems not very frequent on contagion and the contagion extent is not that much for a small connectivities. I tried to run the code under a small network with only 60 nodes, the results still not good:
it has a little similar shape with the figure 1. But this still not good and the small network is not what I want.
I don't know what problems with my code, if you have any ideas please help me with this.